mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 22:41:50 +00:00
Add -Z maximal-hir-to-mir-coverage flag
This commit is contained in:
parent
d1449560e3
commit
3bf7d88ef1
@ -747,6 +747,7 @@ fn test_unstable_options_tracking_hash() {
|
||||
tracked!(link_only, true);
|
||||
tracked!(llvm_plugins, vec![String::from("plugin_name")]);
|
||||
tracked!(location_detail, LocationDetail { file: true, line: false, column: false });
|
||||
tracked!(maximal_hir_to_mir_coverage, true);
|
||||
tracked!(merge_functions, Some(MergeFunctions::Disabled));
|
||||
tracked!(mir_emit_retag, true);
|
||||
tracked!(mir_enable_passes, vec![("DestProp".to_string(), false)]);
|
||||
|
@ -173,6 +173,16 @@ impl TyCtxt<'_> {
|
||||
/// Walks upwards from `id` to find a node which might change lint levels with attributes.
|
||||
/// It stops at `bound` and just returns it if reached.
|
||||
pub fn maybe_lint_level_root_bounded(self, mut id: HirId, bound: HirId) -> HirId {
|
||||
// Some consumers of rustc need to map MIR locations back to HIR nodes. Currently the
|
||||
// the only part of rustc that tracks MIR -> HIR is the `SourceScopeLocalData::lint_root`
|
||||
// field that tracks lint levels for MIR locations. Normally the number of source scopes
|
||||
// is limited to the set of nodes with lint annotations. The -Zmaximal-hir-to-mir-coverage
|
||||
// flag changes this behavior to maximize the number of source scopes, increasing the
|
||||
// granularity of the MIR->HIR mapping.
|
||||
if self.sess.opts.unstable_opts.maximal_hir_to_mir_coverage {
|
||||
return id;
|
||||
}
|
||||
|
||||
let hir = self.hir();
|
||||
loop {
|
||||
if id == bound {
|
||||
|
@ -1382,6 +1382,9 @@ options! {
|
||||
"list the symbols defined by a library crate (default: no)"),
|
||||
macro_backtrace: bool = (false, parse_bool, [UNTRACKED],
|
||||
"show macro backtraces (default: no)"),
|
||||
maximal_hir_to_mir_coverage: bool = (false, parse_bool, [TRACKED],
|
||||
"save as much information as possible about the correspondence between MIR and HIR \
|
||||
as source scopes (default: no)"),
|
||||
merge_functions: Option<MergeFunctions> = (None, parse_merge_functions, [TRACKED],
|
||||
"control the operation of the MergeFunctions LLVM pass, taking \
|
||||
the same values as the target option of the same name"),
|
||||
|
@ -77,6 +77,7 @@
|
||||
-Z location-detail=val -- what location details should be tracked when using caller_location, either `none`, or a comma separated list of location details, for which valid options are `file`, `line`, and `column` (default: `file,line,column`)
|
||||
-Z ls=val -- list the symbols defined by a library crate (default: no)
|
||||
-Z macro-backtrace=val -- show macro backtraces (default: no)
|
||||
-Z maximal-hir-to-mir-coverage=val -- save as much information as possible about the correspondence between MIR and HIR as source scopes (default: no)
|
||||
-Z merge-functions=val -- control the operation of the MergeFunctions LLVM pass, taking the same values as the target option of the same name
|
||||
-Z meta-stats=val -- gather metadata statistics (default: no)
|
||||
-Z mir-emit-retag=val -- emit Retagging MIR statements, interpreted e.g., by miri; implies -Zmir-opt-level=0 (default: no)
|
||||
|
10
src/test/ui/maximal_mir_to_hir_coverage.rs
Normal file
10
src/test/ui/maximal_mir_to_hir_coverage.rs
Normal file
@ -0,0 +1,10 @@
|
||||
// compile-flags: -Zmaximal-hir-to-mir-coverage
|
||||
// run-pass
|
||||
|
||||
// Just making sure this flag is accepted and doesn't crash the compiler
|
||||
|
||||
fn main() {
|
||||
let x = 1;
|
||||
let y = x + 1;
|
||||
println!("{y}");
|
||||
}
|
Loading…
Reference in New Issue
Block a user