Skip to content

Commit a771b0f

Browse files
committed
Work around #49998 with experimental code that does less updating of cause map.
This seems to avoid poor scaling on src/test/ui/span/dropck_vec_cycle_checked.rs
1 parent 699c98e commit a771b0f

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/librustc/session/config.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1259,6 +1259,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
12591259
useful for profiling / PGO."),
12601260
relro_level: Option<RelroLevel> = (None, parse_relro_level, [TRACKED],
12611261
"choose which RELRO level to use"),
1262+
nll_subminimal_causes: bool = (false, parse_bool, [UNTRACKED],
1263+
"when tracking region error causes, accept subminimal results for faster execution."),
12621264
disable_nll_user_type_assert: bool = (false, parse_bool, [UNTRACKED],
12631265
"disable user provided type assertion in NLL"),
12641266
trans_time_graph: bool = (false, parse_bool, [UNTRACKED],

src/librustc_mir/borrow_check/nll/region_infer/values.rs

+12-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use rustc_data_structures::fx::FxHashMap;
1414
use rustc_data_structures::indexed_vec::Idx;
1515
use rustc_data_structures::indexed_vec::IndexVec;
1616
use rustc::mir::{BasicBlock, Location, Mir};
17-
use rustc::ty::RegionVid;
17+
use rustc::ty::{self, RegionVid};
1818
use syntax::codemap::Span;
1919

2020
use super::{Cause, CauseExt, TrackCauses};
@@ -263,7 +263,17 @@ impl RegionValues {
263263
if let Some(causes) = &mut self.causes {
264264
let cause = make_cause(causes);
265265
let old_cause = causes.get_mut(&(r, i)).unwrap();
266-
if cause < **old_cause {
266+
// #49998: compare using root cause alone to avoid
267+
// useless traffic from similar outlives chains.
268+
269+
let overwrite = if ty::tls::with(|tcx| {
270+
tcx.sess.opts.debugging_opts.nll_subminimal_causes
271+
}) {
272+
cause.root_cause() < old_cause.root_cause()
273+
} else {
274+
cause < **old_cause
275+
};
276+
if overwrite {
267277
*old_cause = Rc::new(cause);
268278
return true;
269279
}

0 commit comments

Comments
 (0)