Trait rustc_utils::mir::body::BodyExt

source ·
pub trait BodyExt<'tcx> {
    type AllReturnsIter<'a>: Iterator<Item = Location>
       where Self: 'a;
    type AllLocationsIter<'a>: Iterator<Item = Location>
       where Self: 'a;
    type LocationsIter: Iterator<Item = Location>;
    type PlacesIter<'a>: Iterator<Item = Place<'tcx>>
       where Self: 'a;
    type ArgRegionsIter<'a>: Iterator<Item = Region<'tcx>>
       where Self: 'a;
    type ReturnRegionsIter: Iterator<Item = Region<'tcx>>;

    // Required methods
    fn all_returns(&self) -> Self::AllReturnsIter<'_>;
    fn all_locations(&self) -> Self::AllLocationsIter<'_>;
    fn locations_in_block(&self, block: BasicBlock) -> Self::LocationsIter;
    fn debug_info_name_map(&self) -> HashMap<String, Local>;
    fn to_string(&self, tcx: TyCtxt<'tcx>) -> Result<String>;
    fn location_to_hir_id(&self, location: Location) -> HirId;
    fn source_info_to_hir_id(&self, info: &SourceInfo) -> HirId;
    fn control_dependencies(&self) -> ControlDependencies<BasicBlock>;
    fn async_context(
        &self,
        tcx: TyCtxt<'tcx>,
        def_id: DefId
    ) -> Option<Ty<'tcx>>;
    fn all_places(
        &self,
        tcx: TyCtxt<'tcx>,
        def_id: DefId
    ) -> Self::PlacesIter<'_>;
    fn regions_in_args(&self) -> Self::ArgRegionsIter<'_>;
    fn regions_in_return(&self) -> Self::ReturnRegionsIter;
}
Expand description

Extension trait for Body.

Required Associated Types§

source

type AllReturnsIter<'a>: Iterator<Item = Location> where Self: 'a

source

type AllLocationsIter<'a>: Iterator<Item = Location> where Self: 'a

source

type LocationsIter: Iterator<Item = Location>

source

type PlacesIter<'a>: Iterator<Item = Place<'tcx>> where Self: 'a

source

type ArgRegionsIter<'a>: Iterator<Item = Region<'tcx>> where Self: 'a

source

type ReturnRegionsIter: Iterator<Item = Region<'tcx>>

Required Methods§

source

fn all_returns(&self) -> Self::AllReturnsIter<'_>

Returns an iterator over the locations of TerminatorKind::Return instructions in a body.

source

fn all_locations(&self) -> Self::AllLocationsIter<'_>

Returns an iterator over all the locations in a body.

source

fn locations_in_block(&self, block: BasicBlock) -> Self::LocationsIter

Returns all the locations in a BasicBlock.

source

fn debug_info_name_map(&self) -> HashMap<String, Local>

Returns a mapping from source-level variable names to Locals.

source

fn to_string(&self, tcx: TyCtxt<'tcx>) -> Result<String>

Converts a Body to a debug representation.

source

fn location_to_hir_id(&self, location: Location) -> HirId

Returns the [HirId] corresponding to a MIR Location.

You MUST use the -Zmaximize-hir-to-mir-mapping flag for this function to work.

source

fn source_info_to_hir_id(&self, info: &SourceInfo) -> HirId

source

fn control_dependencies(&self) -> ControlDependencies<BasicBlock>

Returns all the control dependencies within the CFG.

See the control_dependencies module documentation for details.

source

fn async_context(&self, tcx: TyCtxt<'tcx>, def_id: DefId) -> Option<Ty<'tcx>>

If this body is an async function, then return the type of the context that holds locals across await calls.

source

fn all_places(&self, tcx: TyCtxt<'tcx>, def_id: DefId) -> Self::PlacesIter<'_>

Returns an iterator over all projections of all local variables in the body.

source

fn regions_in_args(&self) -> Self::ArgRegionsIter<'_>

Returns an iterator over all the regions that appear in argument types to the body.

source

fn regions_in_return(&self) -> Self::ReturnRegionsIter

Returns an iterator over all the regions that appear in the body’s return type.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'tcx> BodyExt<'tcx> for Body<'tcx>

§

type AllReturnsIter<'a> = impl Iterator<Item = Location> + Captures<'tcx> + 'a where Self: 'a

source§

fn all_returns(&self) -> Self::AllReturnsIter<'_>

§

type AllLocationsIter<'a> = impl Iterator<Item = Location> + Captures<'tcx> + 'a where Self: 'a

source§

fn all_locations(&self) -> Self::AllLocationsIter<'_>

§

type LocationsIter = impl Iterator<Item = Location>

source§

fn locations_in_block(&self, block: BasicBlock) -> Self::LocationsIter

source§

fn debug_info_name_map(&self) -> HashMap<String, Local>

source§

fn to_string(&self, tcx: TyCtxt<'tcx>) -> Result<String>

source§

fn location_to_hir_id(&self, location: Location) -> HirId

source§

fn source_info_to_hir_id(&self, info: &SourceInfo) -> HirId

source§

fn control_dependencies(&self) -> ControlDependencies<BasicBlock>

source§

fn async_context(&self, tcx: TyCtxt<'tcx>, def_id: DefId) -> Option<Ty<'tcx>>

§

type ArgRegionsIter<'a> = impl Iterator<Item = Region<'tcx>> + Captures<'tcx> + 'a where Self: 'a

§

type ReturnRegionsIter = impl Iterator<Item = Region<'tcx>>

§

type PlacesIter<'a> = impl Iterator<Item = Place<'tcx>> + Captures<'tcx> + 'a where Self: 'a

source§

fn regions_in_args(&self) -> Self::ArgRegionsIter<'_>

source§

fn regions_in_return(&self) -> Self::ReturnRegionsIter

source§

fn all_places(&self, tcx: TyCtxt<'tcx>, def_id: DefId) -> Self::PlacesIter<'_>

Implementors§