Work around rust-lang/rust#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
This commit is contained in:
Felix S. Klock II 2018-04-18 14:22:08 +02:00
parent 699c98ec6a
commit a771b0f075
2 changed files with 14 additions and 2 deletions

View file

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

View file

@ -14,7 +14,7 @@ use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::indexed_vec::Idx;
use rustc_data_structures::indexed_vec::IndexVec;
use rustc::mir::{BasicBlock, Location, Mir};
use rustc::ty::RegionVid;
use rustc::ty::{self, RegionVid};
use syntax::codemap::Span;
use super::{Cause, CauseExt, TrackCauses};
@ -263,7 +263,17 @@ impl RegionValues {
if let Some(causes) = &mut self.causes {
let cause = make_cause(causes);
let old_cause = causes.get_mut(&(r, i)).unwrap();
if cause < **old_cause {
// #49998: compare using root cause alone to avoid
// useless traffic from similar outlives chains.
let overwrite = if ty::tls::with(|tcx| {
tcx.sess.opts.debugging_opts.nll_subminimal_causes
}) {
cause.root_cause() < old_cause.root_cause()
} else {
cause < **old_cause
};
if overwrite {
*old_cause = Rc::new(cause);
return true;
}