// prove that the trait applies to the types that were
// used, and adding the predicate into this list ensures
// that this is done.
- let mut span = tcx.def_span(def_id);
- if tcx.sess.source_map().is_local_span(span) {
- // `guess_head_span` reads the actual source file from
- // disk to try to determine the 'head' snippet of the span.
- // Don't do this for a span that comes from a file outside
- // of our crate, since this would make our query output
- // (and overall crate metadata) dependent on the
- // *current* state of an external file.
- span = tcx.sess.source_map().guess_head_span(span);
- }
+ //
+ // We use a DUMMY_SP here as a way to signal trait bounds that come
+ // from the trait itself that *shouldn't* be shown as the source of
+ // an obligation and instead be skipped. Otherwise we'd use
+ // `tcx.def_span(def_id);`
+ let span = rustc_span::DUMMY_SP;
result.predicates =
tcx.arena.alloc_from_iter(result.predicates.iter().copied().chain(std::iter::once((
ty::TraitRef::identity(tcx, def_id).without_const().to_predicate(tcx),