Struct rustc_mir_build::thir::cx::Cx

source ·
struct Cx<'tcx> {
    tcx: TyCtxt<'tcx>,
    thir: Thir<'tcx>,
    param_env: ParamEnv<'tcx>,
    region_scope_tree: &'tcx ScopeTree,
    typeck_results: &'tcx TypeckResults<'tcx>,
    rvalue_scopes: &'tcx RvalueScopes,
    adjustment_span: Option<(HirId, Span)>,
    apply_adjustments: bool,
    body_owner: DefId,
}

Fields§

§tcx: TyCtxt<'tcx>§thir: Thir<'tcx>§param_env: ParamEnv<'tcx>§region_scope_tree: &'tcx ScopeTree§typeck_results: &'tcx TypeckResults<'tcx>§rvalue_scopes: &'tcx RvalueScopes§adjustment_span: Option<(HirId, Span)>

When applying adjustments to the expression with the given HirId, use the given Span, instead of the usual span. This is used to assign the span of an overall method call (e.g. my_val.foo()) to the adjustment expressions for the receiver.

§apply_adjustments: bool

False to indicate that adjustments should not be applied. Only used for custom_mir

§body_owner: DefId

The DefId of the owner of this body.

Implementations§

source§

impl<'tcx> Cx<'tcx>

source

pub(crate) fn mirror_block(&mut self, block: &'tcx Block<'tcx>) -> BlockId

source

fn mirror_stmts(
&mut self,
block_id: ItemLocalId,
stmts: &'tcx [Stmt<'tcx>]
) -> Box<[StmtId]>

source§

impl<'tcx> Cx<'tcx>

source

pub(crate) fn mirror_expr(&mut self, expr: &'tcx Expr<'tcx>) -> ExprId

source

pub(crate) fn mirror_exprs(&mut self, exprs: &'tcx [Expr<'tcx>]) -> Box<[ExprId]>

source

pub(super) fn mirror_expr_inner(&mut self, hir_expr: &'tcx Expr<'tcx>) -> ExprId

source

fn apply_adjustment(
&mut self,
hir_expr: &'tcx Expr<'tcx>,
expr: Expr<'tcx>,
adjustment: &Adjustment<'tcx>,
span: Span
) -> Expr<'tcx>

source

fn mirror_expr_cast(
&mut self,
source: &'tcx Expr<'tcx>,
temp_lifetime: Option<Scope>,
span: Span
) -> ExprKind<'tcx>

Lowers a cast expression.

Dealing with user type annotations is left to the caller.

source

fn make_mirror_unadjusted(&mut self, expr: &'tcx Expr<'tcx>) -> Expr<'tcx>

source

fn user_substs_applied_to_res(
&mut self,
hir_id: HirId,
res: Res
) -> Option<Box<CanonicalUserType<'tcx>>>

source

fn method_callee(
&mut self,
expr: &Expr<'_>,
span: Span,
overloaded_callee: Option<Ty<'tcx>>
) -> Expr<'tcx>

source

fn convert_arm(&mut self, arm: &'tcx Arm<'tcx>) -> ArmId

source

fn convert_path_expr(
&mut self,
expr: &'tcx Expr<'tcx>,
res: Res
) -> ExprKind<'tcx>

source

fn convert_var(&mut self, var_hir_id: HirId) -> ExprKind<'tcx>

source

fn overloaded_operator(
&mut self,
expr: &'tcx Expr<'tcx>,
args: Box<[ExprId]>
) -> ExprKind<'tcx>

source

fn overloaded_place(
&mut self,
expr: &'tcx Expr<'tcx>,
place_ty: Ty<'tcx>,
overloaded_callee: Option<Ty<'tcx>>,
args: Box<[ExprId]>,
span: Span
) -> ExprKind<'tcx>

source

fn convert_captured_hir_place(
&mut self,
closure_expr: &'tcx Expr<'tcx>,
place: HirPlace<'tcx>
) -> Expr<'tcx>

source

fn capture_upvar(
&mut self,
closure_expr: &'tcx Expr<'tcx>,
captured_place: &'tcx CapturedPlace<'tcx>,
upvar_ty: Ty<'tcx>
) -> Expr<'tcx>

source

fn field_refs(&mut self, fields: &'tcx [ExprField<'tcx>]) -> Box<[FieldExpr]>

Converts a list of named fields (i.e., for struct-like struct/enum ADTs) into FieldExpr.

source§

impl<'tcx> Cx<'tcx>

source

fn new(tcx: TyCtxt<'tcx>, def: WithOptConstParam<LocalDefId>) -> Cx<'tcx>

source

fn pattern_from_hir(&mut self, p: &Pat<'_>) -> Box<Pat<'tcx>>

source

fn closure_env_param(
&self,
owner_def: LocalDefId,
owner_id: HirId
) -> Option<Param<'tcx>>

source

fn explicit_params<'a>(
&'a mut self,
owner_id: HirId,
fn_decl: &'tcx FnDecl<'tcx>,
body: &'tcx Body<'tcx>
) -> impl Iterator<Item = Param<'tcx>> + 'a

Trait Implementations§

source§

impl<'tcx> UserAnnotatedTyHelpers<'tcx> for Cx<'tcx>

source§

fn tcx(&self) -> TyCtxt<'tcx>

source§

fn typeck_results(&self) -> &TypeckResults<'tcx>

source§

fn user_substs_applied_to_ty_of_hir_id(
&self,
hir_id: HirId
) -> Option<CanonicalUserType<'tcx>>

Looks up the type associated with this hir-id and applies the user-given substitutions; the hir-id must map to a suitable type.

Auto Trait Implementations§

§

impl<'tcx> !RefUnwindSafe for Cx<'tcx>

§

impl<'tcx> !Send for Cx<'tcx>

§

impl<'tcx> !Sync for Cx<'tcx>

§

impl<'tcx> Unpin for Cx<'tcx>

§

impl<'tcx> !UnwindSafe for Cx<'tcx>

Blanket Implementations§

source§

impl<T> Any for Twhere
T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere
T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere
T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere
U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere
U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere
U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.

Size: 192 bytes