pub trait BodyExt<'tcx> {
// Required methods
fn all_returns(&self) -> impl Iterator<Item = Location> + '_;
fn all_locations(&self) -> impl Iterator<Item = Location> + '_;
fn locations_in_block(
&self,
block: BasicBlock,
) -> impl Iterator<Item = Location>;
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,
) -> impl Iterator<Item = Place<'tcx>> + '_;
fn regions_in_args(&self) -> impl Iterator<Item = Region<'tcx>> + '_;
fn regions_in_return(&self) -> impl Iterator<Item = Region<'tcx>> + '_;
}
Expand description
Extension trait for Body
.
Required Methods§
Sourcefn all_returns(&self) -> impl Iterator<Item = Location> + '_
fn all_returns(&self) -> impl Iterator<Item = Location> + '_
Returns an iterator over the locations of TerminatorKind::Return
instructions in a body.
Sourcefn all_locations(&self) -> impl Iterator<Item = Location> + '_
fn all_locations(&self) -> impl Iterator<Item = Location> + '_
Returns an iterator over all the locations in a body.
Sourcefn locations_in_block(
&self,
block: BasicBlock,
) -> impl Iterator<Item = Location>
fn locations_in_block( &self, block: BasicBlock, ) -> impl Iterator<Item = Location>
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,
) -> impl Iterator<Item = Place<'tcx>> + '_
fn all_places( &self, tcx: TyCtxt<'tcx>, def_id: DefId, ) -> impl Iterator<Item = Place<'tcx>> + '_
Returns an iterator over all projections of all local variables in the body.
Sourcefn regions_in_args(&self) -> impl Iterator<Item = Region<'tcx>> + '_
fn regions_in_args(&self) -> impl Iterator<Item = Region<'tcx>> + '_
Returns an iterator over all the regions that appear in argument types to the body.
Sourcefn regions_in_return(&self) -> impl Iterator<Item = Region<'tcx>> + '_
fn regions_in_return(&self) -> impl Iterator<Item = Region<'tcx>> + '_
Returns an iterator over all the regions that appear in the body’s return type.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.