[−][src]Function rustc_mir::transform::rustc_peek::sanity_check_via_rustc_peek
pub fn sanity_check_via_rustc_peek<'a, 'tcx, O>(
tcx: TyCtxt<'a, 'tcx, 'tcx>,
mir: &Mir<'tcx>,
id: NodeId,
_attributes: &[Attribute],
results: &DataflowResults<O>
) where
O: BitDenotation<Idx = MovePathIndex> + HasMoveData<'tcx>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
This function scans mir
for all calls to the intrinsic
rustc_peek
that have the expression form rustc_peek(&expr)
.
For each such call, determines what the dataflow bit-state is for
the L-value corresponding to expr
; if the bit-state is a 1, then
that call to rustc_peek
is ignored by the sanity check. If the
bit-state is a 0, then this pass emits a error message saying
"rustc_peek: bit not set".
The intention is that one can write unit tests for dataflow by
putting code into a compile-fail test and using rustc_peek
to
make observations about the results of dataflow static analyses.
(If there are any calls to rustc_peek
that do not match the
expression form above, then that emits an error as well, but those
errors are not intended to be used for unit tests.)