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>,
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§
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 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§
source§impl<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,
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, _: &[QueryInfo]) -> 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: 120 bytes