diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index 709b84452652..abdd7fd8d40b 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -251,25 +251,17 @@ impl PrintContext { fn parameterized(&mut self, f: &mut F, substs: &subst::Substs<'_>, - mut did: DefId, + did: DefId, projections: &[ty::ProjectionPredicate<'_>]) -> fmt::Result { let key = ty::tls::with(|tcx| tcx.def_key(did)); - let mut item_name = if let Some(name) = key.disambiguated_data.data.get_opt_name() { - Some(name) - } else { - did.index = key.parent.unwrap_or_else( - || bug!("finding type for {:?}, encountered def-id {:?} with no parent", - did, did)); - self.parameterized(f, substs, did, projections)?; - return write!(f, "::{}", key.disambiguated_data.data.as_interned_str()); - }; let verbose = self.is_verbose; let mut num_supplied_defaults = 0; let mut has_self = false; let mut own_counts: GenericParamCount = Default::default(); let mut is_value_path = false; + let mut item_name = Some(key.disambiguated_data.data.as_interned_str()); let fn_trait_kind = ty::tls::with(|tcx| { // Unfortunately, some kinds of items (e.g., closures) don't have // generics. So walk back up the find the closest parent that DOES @@ -282,6 +274,7 @@ impl PrintContext { DefPathData::AssocTypeInImpl(_) | DefPathData::AssocExistentialInImpl(_) | DefPathData::Trait(_) | + DefPathData::Impl | DefPathData::TypeNs(_) => { break; } @@ -292,7 +285,6 @@ impl PrintContext { } DefPathData::CrateRoot | DefPathData::Misc | - DefPathData::Impl | DefPathData::Module(_) | DefPathData::MacroDef(_) | DefPathData::ClosureExpr | diff --git a/src/librustc_mir/const_eval.rs b/src/librustc_mir/const_eval.rs index 362fbc4b1355..d92001704285 100644 --- a/src/librustc_mir/const_eval.rs +++ b/src/librustc_mir/const_eval.rs @@ -612,6 +612,13 @@ pub fn const_eval_raw_provider<'a, 'tcx>( other => return other, } } + // the first trace is for replicating an ice + // There's no tracking issue, but the next two lines concatenated link to the discussion on + // zulip. It's not really possible to test this, because it doesn't show up in diagnostics + // or MIR. + // https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/ + // subject/anon_const_instance_printing/near/135980032 + trace!("const eval: {}", key.value.instance); trace!("const eval: {:?}", key); let cid = key.value;