Struct rustc_middle::mir::patch::MirPatch
source · pub struct MirPatch<'tcx> {
patch_map: IndexVec<BasicBlock, Option<TerminatorKind<'tcx>>>,
new_blocks: Vec<BasicBlockData<'tcx>>,
new_statements: Vec<(Location, StatementKind<'tcx>)>,
new_locals: Vec<LocalDecl<'tcx>>,
resume_block: Option<BasicBlock>,
unreachable_cleanup_block: Option<BasicBlock>,
terminate_block: Option<(BasicBlock, UnwindTerminateReason)>,
body_span: Span,
next_local: usize,
}
Expand description
This struct represents a patch to MIR, which can add new statements and basic blocks and patch over block terminators.
Fields§
§patch_map: IndexVec<BasicBlock, Option<TerminatorKind<'tcx>>>
§new_blocks: Vec<BasicBlockData<'tcx>>
§new_statements: Vec<(Location, StatementKind<'tcx>)>
§new_locals: Vec<LocalDecl<'tcx>>
§resume_block: Option<BasicBlock>
§unreachable_cleanup_block: Option<BasicBlock>
§terminate_block: Option<(BasicBlock, UnwindTerminateReason)>
§body_span: Span
§next_local: usize
Implementations§
source§impl<'tcx> MirPatch<'tcx>
impl<'tcx> MirPatch<'tcx>
pub fn new(body: &Body<'tcx>) -> Self
pub fn resume_block(&mut self) -> BasicBlock
pub fn unreachable_cleanup_block(&mut self) -> BasicBlock
pub fn terminate_block(&mut self, reason: UnwindTerminateReason) -> BasicBlock
pub fn is_patched(&self, bb: BasicBlock) -> bool
pub fn terminator_loc(&self, body: &Body<'tcx>, bb: BasicBlock) -> Location
pub fn new_local_with_info( &mut self, ty: Ty<'tcx>, span: Span, local_info: LocalInfo<'tcx> ) -> Local
pub fn new_temp(&mut self, ty: Ty<'tcx>, span: Span) -> Local
pub fn new_block(&mut self, data: BasicBlockData<'tcx>) -> BasicBlock
pub fn patch_terminator(&mut self, block: BasicBlock, new: TerminatorKind<'tcx>)
pub fn add_statement(&mut self, loc: Location, stmt: StatementKind<'tcx>)
pub fn add_assign( &mut self, loc: Location, place: Place<'tcx>, rv: Rvalue<'tcx> )
pub fn apply(self, body: &mut Body<'tcx>)
pub fn source_info_for_index( data: &BasicBlockData<'_>, loc: Location ) -> SourceInfo
pub fn source_info_for_location( &self, body: &Body<'tcx>, loc: Location ) -> SourceInfo
Auto Trait Implementations§
impl<'tcx> !RefUnwindSafe for MirPatch<'tcx>
impl<'tcx> !Send for MirPatch<'tcx>
impl<'tcx> !Sync for MirPatch<'tcx>
impl<'tcx> Unpin for MirPatch<'tcx>
impl<'tcx> !UnwindSafe for MirPatch<'tcx>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
source§impl<P> IntoQueryParam<P> for P
impl<P> IntoQueryParam<P> for P
fn into_query_param(self) -> P
source§impl<T> MaybeResult<T> for T
impl<T> MaybeResult<T> for T
source§impl<'tcx, T> ToPredicate<'tcx, T> for T
impl<'tcx, T> ToPredicate<'tcx, T> for T
fn to_predicate(self, _tcx: TyCtxt<'tcx>) -> T
source§impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
impl<Tcx, T> Value<Tcx> for Twhere Tcx: DepContext,
default fn from_cycle_error( tcx: Tcx, cycle: &[QueryInfo], _guar: ErrorGuaranteed ) -> T
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: 128 bytes