pub type ProvidedValue<'tcx> = Body<'tcx>;
Expand description

This type alias specifies the type returned from query providers and the type used for decoding. For regular queries this is the declared returned type V, but arena_cache will use <V as Deref>::Target instead.

Implementations§

source§

impl<'tcx> Body<'tcx>

source

pub fn new( source: MirSource<'tcx>, basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>, source_scopes: IndexVec<SourceScope, SourceScopeData<'tcx>>, local_decls: IndexVec<Local, LocalDecl<'tcx>>, user_type_annotations: CanonicalUserTypeAnnotations<'tcx>, arg_count: usize, var_debug_info: Vec<VarDebugInfo<'tcx>>, span: Span, generator_kind: Option<GeneratorKind>, tainted_by_errors: Option<ErrorGuaranteed> ) -> Self

source

pub fn new_cfg_only( basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>> ) -> Self

Returns a partially initialized MIR body containing only a list of basic blocks.

The returned MIR contains no LocalDecls (even for the return place) or source scopes. It is only useful for testing but cannot be #[cfg(test)] because it is used in a different crate.

source

pub fn basic_blocks_mut( &mut self ) -> &mut IndexVec<BasicBlock, BasicBlockData<'tcx>>

source

pub fn local_kind(&self, local: Local) -> LocalKind

source

pub fn mut_vars_iter<'a>( &'a self ) -> impl Iterator<Item = Local> + Captures<'tcx> + 'a

Returns an iterator over all user-declared mutable locals.

source

pub fn mut_vars_and_args_iter<'a>( &'a self ) -> impl Iterator<Item = Local> + Captures<'tcx> + 'a

Returns an iterator over all user-declared mutable arguments and locals.

source

pub fn args_iter(&self) -> impl Iterator<Item = Local> + ExactSizeIterator

Returns an iterator over all function arguments.

source

pub fn vars_and_temps_iter( &self ) -> impl DoubleEndedIterator<Item = Local> + ExactSizeIterator

Returns an iterator over all user-defined variables and compiler-generated temporaries (all locals that are neither arguments nor the return place).

source

pub fn drain_vars_and_temps<'a>( &'a mut self ) -> impl Iterator<Item = LocalDecl<'tcx>> + 'a

source

pub fn source_info(&self, location: Location) -> &SourceInfo

Returns the source info associated with location.

source

pub fn return_ty(&self) -> Ty<'tcx>

Returns the return type; it always return first element from local_decls array.

source

pub fn bound_return_ty(&self) -> EarlyBinder<Ty<'tcx>>

Returns the return type; it always return first element from local_decls array.

source

pub fn terminator_loc(&self, bb: BasicBlock) -> Location

Gets the location of the terminator for the given block.

source

pub fn stmt_at( &self, location: Location ) -> Either<&Statement<'tcx>, &Terminator<'tcx>>

source

pub fn yield_ty(&self) -> Option<Ty<'tcx>>

source

pub fn generator_layout(&self) -> Option<&GeneratorLayout<'tcx>>

source

pub fn generator_drop(&self) -> Option<&Body<'tcx>>

source

pub fn generator_kind(&self) -> Option<GeneratorKind>

source

pub fn should_skip(&self) -> bool

source

pub fn is_custom_mir(&self) -> bool

source

pub fn post_mono_checks( &self, tcx: TyCtxt<'tcx>, param_env: ParamEnv<'tcx>, normalize_const: impl Fn(Const<'tcx>) -> Result<Const<'tcx>, ErrorHandled> ) -> Result<(), ErrorHandled>

Must be called once the full substitution for this body is known, to ensure that the body is indeed fit for code generation or consumption more generally.

Sadly there’s no nice way to represent an “arbitrary normalizer”, so we take one for constants specifically. (Option<GenericArgsRef> could be used for that, but the fact that Instance::args_for_mir_body is private and instead instance exposes normalization functions makes it seem like exposing the generic args is not the intended strategy.)

Also sadly, CTFE doesn’t even know whether it runs on MIR that is already polymorphic or still monomorphic, so we cannot just immediately ICE on TooGeneric.

Returns Ok(()) if everything went fine, and Err if a problem occurred and got reported.

Trait Implementations§

source§

impl<'tcx> ArenaAllocatable<'tcx, IsNotCopy> for Body<'tcx>

source§

fn allocate_on<'a>(self, arena: &'a Arena<'tcx>) -> &'a mut Self

source§

fn allocate_from_iter<'a>( arena: &'a Arena<'tcx>, iter: impl IntoIterator<Item = Self> ) -> &'a mut [Self]

source§

impl<'tcx> Clone for Body<'tcx>

source§

fn clone(&self) -> Body<'tcx>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'tcx> Debug for Body<'tcx>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'tcx, D: TyDecoder<I = TyCtxt<'tcx>>> Decodable<D> for &'tcx Body<'tcx>

source§

fn decode(decoder: &mut D) -> Self

source§

impl<'tcx, __D: TyDecoder<I = TyCtxt<'tcx>>> Decodable<__D> for Body<'tcx>

source§

fn decode(__decoder: &mut __D) -> Self

source§

impl<'tcx, __E: TyEncoder<I = TyCtxt<'tcx>>> Encodable<__E> for Body<'tcx>

source§

fn encode(&self, __encoder: &mut __E)

source§

impl<'tcx> HasLocalDecls<'tcx> for Body<'tcx>

source§

fn local_decls(&self) -> &LocalDecls<'tcx>

source§

impl<'tcx, '__ctx> HashStable<StableHashingContext<'__ctx>> for Body<'tcx>

source§

fn hash_stable( &self, __hcx: &mut StableHashingContext<'__ctx>, __hasher: &mut StableHasher )

source§

impl<'tcx> Index<BasicBlock> for Body<'tcx>

§

type Output = BasicBlockData<'tcx>

The returned type after indexing.
source§

fn index(&self, index: BasicBlock) -> &BasicBlockData<'tcx>

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

impl<'tcx> IndexMut<BasicBlock> for Body<'tcx>

source§

fn index_mut(&mut self, index: BasicBlock) -> &mut BasicBlockData<'tcx>

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

impl ParameterizedOverTcx for Body<'static>

§

type Value<'tcx> = Body<'tcx>

source§

impl<'tcx, D: TyDecoder<I = TyCtxt<'tcx>>> RefDecodable<'tcx, D> for Body<'tcx>

source§

impl<'tcx> TypeFoldable<TyCtxt<'tcx>> for Body<'tcx>

source§

fn try_fold_with<__F: FallibleTypeFolder<TyCtxt<'tcx>>>( self, __folder: &mut __F ) -> Result<Self, __F::Error>

The entry point for folding. To fold a value t with a folder f call: t.try_fold_with(f). Read more
source§

fn fold_with<F>(self, folder: &mut F) -> Selfwhere F: TypeFolder<I>,

A convenient alternative to try_fold_with for use with infallible folders. Do not override this method, to ensure coherence with try_fold_with.
source§

impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for Body<'tcx>

source§

fn visit_with<__V: TypeVisitor<TyCtxt<'tcx>>>( &self, __visitor: &mut __V ) -> ControlFlow<__V::BreakTy>

The entry point for visiting. To visit a value t with a visitor v call: t.visit_with(v). Read more

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