rustc_smir::rustc_smir

Struct Tables

Source
pub struct Tables<'tcx> {
    pub(crate) tcx: TyCtxt<'tcx>,
    pub(crate) def_ids: IndexMap<DefId, DefId>,
    pub(crate) alloc_ids: IndexMap<AllocId, AllocId>,
    pub(crate) spans: IndexMap<Span, Span>,
    pub(crate) types: IndexMap<Ty<'tcx>, Ty>,
    pub(crate) instances: IndexMap<Instance<'tcx>, InstanceDef>,
    pub(crate) ty_consts: IndexMap<Const<'tcx>, TyConstId>,
    pub(crate) mir_consts: IndexMap<Const<'tcx>, MirConstId>,
    pub(crate) layouts: IndexMap<Layout<'tcx>, Layout>,
}

Fields§

§tcx: TyCtxt<'tcx>§def_ids: IndexMap<DefId, DefId>§alloc_ids: IndexMap<AllocId, AllocId>§spans: IndexMap<Span, Span>§types: IndexMap<Ty<'tcx>, Ty>§instances: IndexMap<Instance<'tcx>, InstanceDef>§ty_consts: IndexMap<Const<'tcx>, TyConstId>§mir_consts: IndexMap<Const<'tcx>, MirConstId>§layouts: IndexMap<Layout<'tcx>, Layout>

Implementations§

Source§

impl<'tcx> Tables<'tcx>

Source

pub fn crate_item(&mut self, did: DefId) -> CrateItem

Source

pub fn adt_def(&mut self, did: DefId) -> AdtDef

Source

pub fn foreign_module_def(&mut self, did: DefId) -> ForeignModuleDef

Source

pub fn foreign_def(&mut self, did: DefId) -> ForeignDef

Source

pub fn fn_def(&mut self, did: DefId) -> FnDef

Source

pub fn closure_def(&mut self, did: DefId) -> ClosureDef

Source

pub fn coroutine_def(&mut self, did: DefId) -> CoroutineDef

Source

pub fn alias_def(&mut self, did: DefId) -> AliasDef

Source

pub fn param_def(&mut self, did: DefId) -> ParamDef

Source

pub fn br_named_def(&mut self, did: DefId) -> BrNamedDef

Source

pub fn trait_def(&mut self, did: DefId) -> TraitDef

Source

pub fn generic_def(&mut self, did: DefId) -> GenericDef

Source

pub fn const_def(&mut self, did: DefId) -> ConstDef

Source

pub fn impl_def(&mut self, did: DefId) -> ImplDef

Source

pub fn region_def(&mut self, did: DefId) -> RegionDef

Source

pub fn coroutine_witness_def(&mut self, did: DefId) -> CoroutineWitnessDef

Source

pub fn prov(&mut self, aid: AllocId) -> Prov

Source

pub(crate) fn create_def_id(&mut self, did: DefId) -> DefId

Source

pub(crate) fn create_alloc_id(&mut self, aid: AllocId) -> AllocId

Source

pub(crate) fn create_span(&mut self, span: Span) -> Span

Source

pub(crate) fn instance_def(&mut self, instance: Instance<'tcx>) -> InstanceDef

Source

pub(crate) fn static_def(&mut self, did: DefId) -> StaticDef

Source

pub(crate) fn layout_id(&mut self, layout: Layout<'tcx>) -> Layout

Source§

impl<'tcx> Tables<'tcx>

Source

pub(crate) fn intern_ty(&mut self, ty: Ty<'tcx>) -> Ty

Source

pub(crate) fn intern_ty_const(&mut self, ct: Const<'tcx>) -> TyConstId

Source

pub(crate) fn intern_mir_const(&mut self, constant: Const<'tcx>) -> MirConstId

Source

pub(crate) fn instance_has_body(&self, instance: Instance<'tcx>) -> bool

Return whether the instance as a body available.

Items and intrinsics may have a body available from its definition. Shims body may be generated depending on their type.

Source

pub(crate) fn item_has_body(&self, def_id: DefId) -> bool

Return whether the item has a body defined by the user.

Note that intrinsics may have a placeholder body that shouldn’t be used in practice. In StableMIR, we handle this case as if the body is not available.

Trait Implementations§

Source§

impl<'tcx> FnAbiOfHelpers<'tcx> for Tables<'tcx>

Implement error handling for extracting function ABI information.

Source§

type FnAbiOfResult = Result<&'tcx FnAbi<'tcx, Ty<'tcx>>, Error>

The &FnAbi-wrapping type (or &FnAbi itself), which will be returned from fn_abi_of_* (see also handle_fn_abi_err).
Source§

fn handle_fn_abi_err( &self, err: FnAbiError<'tcx>, _span: Span, fn_abi_request: FnAbiRequest<'tcx>, ) -> Error

Helper used for fn_abi_of_*, to adapt tcx.fn_abi_of_*(...) into a Self::FnAbiOfResult (which does not need to be a Result<...>). Read more
Source§

impl<'tcx> HasDataLayout for Tables<'tcx>

Source§

fn data_layout(&self) -> &TargetDataLayout

Source§

impl<'tcx> HasParamEnv<'tcx> for Tables<'tcx>

Source§

fn param_env(&self) -> ParamEnv<'tcx>

Source§

impl<'tcx> HasTyCtxt<'tcx> for Tables<'tcx>

Source§

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

Source§

impl<'tcx> Index<DefId> for Tables<'tcx>

Source§

type Output = DefId

The returned type after indexing.
Source§

fn index(&self, index: DefId) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<'tcx> Index<Span> for Tables<'tcx>

Source§

type Output = Span

The returned type after indexing.
Source§

fn index(&self, index: Span) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<'tcx> LayoutOfHelpers<'tcx> for Tables<'tcx>

Source§

type LayoutOfResult = Result<TyAndLayout<'tcx, Ty<'tcx>>, Error>

The TyAndLayout-wrapping type (or TyAndLayout itself), which will be returned from layout_of (see also handle_layout_err).
Source§

fn handle_layout_err( &self, err: LayoutError<'tcx>, _span: Span, ty: Ty<'tcx>, ) -> Error

Helper used for layout_of, to adapt tcx.layout_of(...) into a Self::LayoutOfResult (which does not need to be a Result<...>). Read more
Source§

fn layout_tcx_at_span(&self) -> Span

Span to use for tcx.at(span), from layout_of.

Auto Trait Implementations§

§

impl<'tcx> DynSend for Tables<'tcx>

§

impl<'tcx> DynSync for Tables<'tcx>

§

impl<'tcx> Freeze for Tables<'tcx>

§

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

§

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

§

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

§

impl<'tcx> Unpin for Tables<'tcx>

§

impl<'tcx> !UnwindSafe for Tables<'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
§

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

§

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<_>>()).

§

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<'tcx, C> FnAbiOf<'tcx> for C
where C: FnAbiOfHelpers<'tcx>,

Source§

fn fn_abi_of_fn_ptr( &self, sig: Binder<TyCtxt<'tcx>, FnSig<TyCtxt<'tcx>>>, extra_args: &'tcx RawList<(), Ty<'tcx>>, ) -> Self::FnAbiOfResult

Compute a FnAbi suitable for indirect calls, i.e. to fn pointers. Read more
Source§

fn fn_abi_of_instance( &self, instance: Instance<'tcx>, extra_args: &'tcx RawList<(), Ty<'tcx>>, ) -> Self::FnAbiOfResult

Compute a FnAbi suitable for declaring/defining an fn instance, and for direct calls to an fn. 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<'tcx, C> LayoutOf<'tcx> for C
where C: LayoutOfHelpers<'tcx>,

Source§

fn layout_of(&self, ty: Ty<'tcx>) -> Self::LayoutOfResult

Computes the layout of a type. Note that this implicitly executes in “reveal all” mode, and will normalize the input type.
Source§

fn spanned_layout_of(&self, ty: Ty<'tcx>, span: Span) -> Self::LayoutOfResult

Computes the layout of a type, at span. Note that this implicitly executes in “reveal all” mode, and will normalize the input type.
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> PointerArithmetic for T
where T: HasDataLayout,

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.
§

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

§

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

§

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

§

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

§

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

§

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