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>,
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>
body_span: Span
next_local: usize
Implementations
sourceimpl<'tcx> MirPatch<'tcx>
impl<'tcx> MirPatch<'tcx>
pub fn new(body: &Body<'tcx>) -> Self
pub fn resume_block(&mut self) -> BasicBlock
pub fn is_patched(&self, bb: BasicBlock) -> bool
pub fn terminator_loc(&self, body: &Body<'tcx>, bb: BasicBlock) -> Location
pub fn new_internal_with_info(
&mut self,
ty: Ty<'tcx>,
span: Span,
local_info: Option<Box<LocalInfo<'tcx>>>
) -> Local
pub fn new_temp(&mut self, ty: Ty<'tcx>, span: Span) -> Local
pub fn new_internal(&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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T, R> InternIteratorElement<T, R> for T
impl<T, R> InternIteratorElement<T, R> for T
type Output = R
fn intern_with<I, F>(iter: I, f: F) -> <T as InternIteratorElement<T, R>>::Outputwhere
I: Iterator<Item = T>,
F: FnOnce(&[T]) -> R,
sourceimpl<T> MaybeResult<T> for T
impl<T> MaybeResult<T> for T
sourceimpl<CTX, T> Value<CTX> for Twhere
CTX: DepContext,
impl<CTX, T> Value<CTX> for Twhere
CTX: DepContext,
default fn from_cycle_error(tcx: CTX) -> T
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
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: 120 bytes