pub struct MirDumper<'dis, 'de, 'tcx> {
show_pass_num: bool,
pass_name: &'static str,
disambiguator: &'dis dyn Display,
writer: MirWriter<'de, 'tcx>,
}
Expand description
Manages MIR dumping, which is MIR writing done to a file with a specific name. In particular,
it makes it impossible to dump MIR to one of these files when it hasn’t been requested from the
command line. Layered on top of MirWriter
, which does the actual writing.
Fields§
§show_pass_num: bool
§pass_name: &'static str
§disambiguator: &'dis dyn Display
§writer: MirWriter<'de, 'tcx>
Implementations§
Source§impl<'dis, 'de, 'tcx> MirDumper<'dis, 'de, 'tcx>
impl<'dis, 'de, 'tcx> MirDumper<'dis, 'de, 'tcx>
pub fn new( tcx: TyCtxt<'tcx>, pass_name: &'static str, body: &Body<'tcx>, ) -> Option<Self>
pub fn tcx(&self) -> TyCtxt<'tcx>
pub fn set_show_pass_num(self) -> Self
pub fn set_disambiguator(self, disambiguator: &'dis dyn Display) -> Self
pub fn set_extra_data( self, extra_data: &'de dyn Fn(PassWhere, &mut dyn Write) -> Result<()>, ) -> Self
pub fn set_options(self, options: PrettyPrintMirOptions) -> Self
Sourcepub fn dump_mir(&self, body: &Body<'tcx>)
pub fn dump_mir(&self, body: &Body<'tcx>)
If the session is properly configured, dumps a human-readable representation of the MIR (with default pretty-printing options) into:
rustc.node<node_id>.<pass_num>.<pass_name>.<disambiguator>
Output from this function is controlled by passing -Z dump-mir=<filter>
,
where <filter>
takes the following forms:
all
– dump MIR for all fns, all passes, all everything- a filter defined by a set of substrings combined with
&
and|
(&
has higher precedence). At least one of the|
-separated groups must match; an|
-separated group matches if all of its&
-separated substrings are matched.
Example:
nll
== match ifnll
appears in the namefoo & nll
== match iffoo
andnll
both appear in the namefoo & nll | typeck
== match iffoo
andnll
both appear in the name ortypeck
appears in the name.foo & nll | bar & typeck
== match iffoo
andnll
both appear in the name ortypeck
andbar
both appear in the name.
pub fn dump_mir_to_writer( &self, body: &Body<'tcx>, w: &mut dyn Write, ) -> Result<()>
Sourcefn dump_path(&self, extension: &str, body: &Body<'tcx>) -> PathBuf
fn dump_path(&self, extension: &str, body: &Body<'tcx>) -> PathBuf
Returns the path to the filename where we should dump a given MIR. Also used by other bits of code (e.g., NLL inference) that dump graphviz data or other things.
Sourcepub fn create_dump_file(
&self,
extension: &str,
body: &Body<'tcx>,
) -> Result<BufWriter<File>>
pub fn create_dump_file( &self, extension: &str, body: &Body<'tcx>, ) -> Result<BufWriter<File>>
Attempts to open a file where we should dump a given MIR or other
bit of MIR-related data. Used by mir-dump
, but also by other
bits of code (e.g., NLL inference) that dump graphviz data or
other things, and hence takes the extension as an argument.
Auto Trait Implementations§
impl<'dis, 'de, 'tcx> !DynSend for MirDumper<'dis, 'de, 'tcx>
impl<'dis, 'de, 'tcx> !DynSync for MirDumper<'dis, 'de, 'tcx>
impl<'dis, 'de, 'tcx> Freeze for MirDumper<'dis, 'de, 'tcx>
impl<'dis, 'de, 'tcx> !RefUnwindSafe for MirDumper<'dis, 'de, 'tcx>
impl<'dis, 'de, 'tcx> !Send for MirDumper<'dis, 'de, 'tcx>
impl<'dis, 'de, 'tcx> !Sync for MirDumper<'dis, 'de, 'tcx>
impl<'dis, 'de, 'tcx> Unpin for MirDumper<'dis, 'de, 'tcx>
impl<'dis, 'de, 'tcx> !UnwindSafe for MirDumper<'dis, 'de, '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
Source§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§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<T> Pointable for T
impl<T> Pointable for T
Source§impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
Source§impl<I, T> UpcastFrom<I, T> for T
impl<I, T> UpcastFrom<I, T> for T
fn upcast_from(from: T, _tcx: I) -> 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_error: &CycleError, _guar: ErrorGuaranteed, ) -> T
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<T> ErasedDestructor for Twhere
T: 'static,
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: 72 bytes