rustc_mir_build::thir::cx

Struct Cx

Source
struct Cx<'tcx> {
    tcx: TyCtxt<'tcx>,
    thir: Thir<'tcx>,
    typing_env: TypingEnv<'tcx>,
    region_scope_tree: &'tcx ScopeTree,
    typeck_results: &'tcx TypeckResults<'tcx>,
    rvalue_scopes: &'tcx RvalueScopes,
    apply_adjustments: bool,
    body_owner: DefId,
}

Fields§

§tcx: TyCtxt<'tcx>§thir: Thir<'tcx>§typing_env: TypingEnv<'tcx>§region_scope_tree: &'tcx ScopeTree§typeck_results: &'tcx TypeckResults<'tcx>§rvalue_scopes: &'tcx RvalueScopes§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

Create a THIR expression for the given HIR expression. This expands all adjustments and directly adds the type information from the typeck_results. See the dev-guide for more details.

(The term “mirror” in this case does not refer to “flipped” or “reversed”.)

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: TempLifetime, 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_args_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: LocalDefId) -> Cx<'tcx>

Source

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

Source

fn closure_env_param( &self, owner_def: LocalDefId, expr_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_args_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 generic parameters; the hir-id must map to a suitable type.

Auto Trait Implementations§

§

impl<'tcx> DynSend for Cx<'tcx>

§

impl<'tcx> DynSync for Cx<'tcx>

§

impl<'tcx> Freeze for Cx<'tcx>

§

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> Aligned for T

Source§

const ALIGN: Alignment

Alignment of Self.
Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T, R> CollectAndApply<T, R> for T

Source§

fn collect_and_apply<I, F>(iter: I, f: F) -> R
where I: Iterator<Item = T>, F: FnOnce(&[T]) -> R,

Equivalent to f(&iter.collect::<Vec<_>>()).

Source§

type Output = R

Source§

impl<T> Filterable for T

Source§

fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>

Creates a filterable data provider with the given name for debugging. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

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

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<P> IntoQueryParam<P> for P

Source§

impl<T> MaybeResult<T> for T

Source§

type Error = !

Source§

fn from(_: Result<T, <T as MaybeResult<T>>::Error>) -> T

Source§

fn to_result(self) -> Result<T, <T as MaybeResult<T>>::Error>

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<I, T, U> Upcast<I, U> for T
where U: UpcastFrom<I, T>,

Source§

fn upcast(self, interner: I) -> U

Source§

impl<I, T> UpcastFrom<I, T> for T

Source§

fn upcast_from(from: T, _tcx: I) -> T

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<Tcx, T> Value<Tcx> for T
where Tcx: DepContext,

Source§

default fn from_cycle_error( tcx: Tcx, cycle_error: &CycleError, _guar: ErrorGuaranteed, ) -> T

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<'a, T> Captures<'a> for T
where T: ?Sized,

Source§

impl<'a, T> Captures<'a> for T
where T: ?Sized,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

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: 208 bytes