Skip to content

Commit b9bd2a6

Browse files
committed
Impl items have generics
1 parent 694cf75 commit b9bd2a6

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

src/librustc/util/ppaux.rs

+3-11
Original file line numberDiff line numberDiff line change
@@ -251,25 +251,17 @@ impl PrintContext {
251251
fn parameterized<F: fmt::Write>(&mut self,
252252
f: &mut F,
253253
substs: &subst::Substs<'_>,
254-
mut did: DefId,
254+
did: DefId,
255255
projections: &[ty::ProjectionPredicate<'_>])
256256
-> fmt::Result {
257257
let key = ty::tls::with(|tcx| tcx.def_key(did));
258-
let mut item_name = if let Some(name) = key.disambiguated_data.data.get_opt_name() {
259-
Some(name)
260-
} else {
261-
did.index = key.parent.unwrap_or_else(
262-
|| bug!("finding type for {:?}, encountered def-id {:?} with no parent",
263-
did, did));
264-
self.parameterized(f, substs, did, projections)?;
265-
return write!(f, "::{}", key.disambiguated_data.data.as_interned_str());
266-
};
267258

268259
let verbose = self.is_verbose;
269260
let mut num_supplied_defaults = 0;
270261
let mut has_self = false;
271262
let mut own_counts: GenericParamCount = Default::default();
272263
let mut is_value_path = false;
264+
let mut item_name = Some(key.disambiguated_data.data.as_interned_str());
273265
let fn_trait_kind = ty::tls::with(|tcx| {
274266
// Unfortunately, some kinds of items (e.g., closures) don't have
275267
// generics. So walk back up the find the closest parent that DOES
@@ -282,6 +274,7 @@ impl PrintContext {
282274
DefPathData::AssocTypeInImpl(_) |
283275
DefPathData::AssocExistentialInImpl(_) |
284276
DefPathData::Trait(_) |
277+
DefPathData::Impl |
285278
DefPathData::TypeNs(_) => {
286279
break;
287280
}
@@ -292,7 +285,6 @@ impl PrintContext {
292285
}
293286
DefPathData::CrateRoot |
294287
DefPathData::Misc |
295-
DefPathData::Impl |
296288
DefPathData::Module(_) |
297289
DefPathData::MacroDef(_) |
298290
DefPathData::ClosureExpr |

src/librustc_mir/const_eval.rs

+7
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,13 @@ pub fn const_eval_raw_provider<'a, 'tcx>(
612612
other => return other,
613613
}
614614
}
615+
// the first trace is for replicating an ice
616+
// There's no tracking issue, but the next two lines concatenated link to the discussion on
617+
// zulip. It's not really possible to test this, because it doesn't show up in diagnostics
618+
// or MIR.
619+
// https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/
620+
// subject/anon_const_instance_printing/near/135980032
621+
trace!("const eval: {}", key.value.instance);
615622
trace!("const eval: {:?}", key);
616623

617624
let cid = key.value;

0 commit comments

Comments
 (0)