diff options
| author | bors <bors@rust-lang.org> | 2022-05-13 06:20:56 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-05-13 06:20:56 +0000 |
| commit | 97d48bec2d2ac7e1aac807e1fe3e8341189db7da (patch) | |
| tree | 51f3dca3a139d127101a148ffb85ab9b14e401cd | |
| parent | f001f9301c889101d8a71358b64b96e9707c832b (diff) | |
| parent | e02129fec0842d567df4b133830edf03d1314248 (diff) | |
| download | rust-97d48bec2d2ac7e1aac807e1fe3e8341189db7da.tar.gz rust-97d48bec2d2ac7e1aac807e1fe3e8341189db7da.zip | |
Auto merge of #96965 - oli-obk:flaky_inliner_ice, r=cjgillot
Gracefully handle normalization failures in the prospective inliner cycle detector Preliminary work for adding the regression test in #96950 to our test suite (it was flaky on glacier). If this PR solves the flakiness on glacier, we can then merge #96950
| -rw-r--r-- | compiler/rustc_mir_transform/src/inline/cycle.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/rustc_mir_transform/src/inline/cycle.rs b/compiler/rustc_mir_transform/src/inline/cycle.rs index ea1ec6249bc..bee6aeebcf8 100644 --- a/compiler/rustc_mir_transform/src/inline/cycle.rs +++ b/compiler/rustc_mir_transform/src/inline/cycle.rs @@ -1,5 +1,4 @@ -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; -use rustc_data_structures::sso::SsoHashSet; +use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet}; use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_middle::mir::TerminatorKind; @@ -45,7 +44,10 @@ crate fn mir_callgraph_reachable<'tcx>( ) -> bool { trace!(%caller); for &(callee, substs) in tcx.mir_inliner_callees(caller.def) { - let substs = caller.subst_mir_and_normalize_erasing_regions(tcx, param_env, substs); + let Ok(substs) = caller.try_subst_mir_and_normalize_erasing_regions(tcx, param_env, substs) else { + trace!(?caller, ?param_env, ?substs, "cannot normalize, skipping"); + continue; + }; let Some(callee) = ty::Instance::resolve(tcx, param_env, callee, substs).unwrap() else { trace!(?callee, "cannot resolve, skipping"); continue; @@ -150,7 +152,7 @@ crate fn mir_inliner_callees<'tcx>( // Functions from other crates and MIR shims _ => tcx.instance_mir(instance), }; - let mut calls = SsoHashSet::new(); + let mut calls = FxIndexSet::default(); for bb_data in body.basic_blocks() { let terminator = bb_data.terminator(); if let TerminatorKind::Call { func, .. } = &terminator.kind { |
