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§
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§
sourcefn all_returns(&self) -> Self::AllReturnsIter<'_>
fn all_returns(&self) -> Self::AllReturnsIter<'_>
Returns an iterator over the locations of TerminatorKind::Return
instructions in a body.
sourcefn all_locations(&self) -> Self::AllLocationsIter<'_>
fn all_locations(&self) -> Self::AllLocationsIter<'_>
Returns an iterator over all the locations in a body.
sourcefn locations_in_block(&self, block: BasicBlock) -> Self::LocationsIter
fn locations_in_block(&self, block: BasicBlock) -> Self::LocationsIter
Returns all the locations in a BasicBlock
.
sourcefn debug_info_name_map(&self) -> HashMap<String, Local>
fn debug_info_name_map(&self) -> HashMap<String, Local>
Returns a mapping from source-level variable names to Local
s.
sourcefn to_string(&self, tcx: TyCtxt<'tcx>) -> Result<String>
fn to_string(&self, tcx: TyCtxt<'tcx>) -> Result<String>
Converts a Body to a debug representation.
sourcefn location_to_hir_id(&self, location: Location) -> HirId
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.
fn source_info_to_hir_id(&self, info: &SourceInfo) -> HirId
sourcefn control_dependencies(&self) -> ControlDependencies<BasicBlock>
fn control_dependencies(&self) -> ControlDependencies<BasicBlock>
Returns all the control dependencies within the CFG.
See the control_dependencies
module documentation
for details.
sourcefn async_context(&self, tcx: TyCtxt<'tcx>, def_id: DefId) -> Option<Ty<'tcx>>
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.
sourcefn all_places(&self, tcx: TyCtxt<'tcx>, def_id: DefId) -> Self::PlacesIter<'_>
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.
sourcefn regions_in_args(&self) -> Self::ArgRegionsIter<'_>
fn regions_in_args(&self) -> Self::ArgRegionsIter<'_>
Returns an iterator over all the regions that appear in argument types to the body.
sourcefn regions_in_return(&self) -> Self::ReturnRegionsIter
fn regions_in_return(&self) -> Self::ReturnRegionsIter
Returns an iterator over all the regions that appear in the body’s return type.