Skip to content

Commit 9423406

Browse files
committed
Explain redundant mapping.
1 parent b77674d commit 9423406

File tree

1 file changed

+4
-0
lines changed
  • compiler/rustc_middle/src/ty

1 file changed

+4
-0
lines changed

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,6 +1332,10 @@ impl<'tcx> OpaqueHiddenType<'tcx> {
13321332
let id_substs = InternalSubsts::identity_for_item(tcx, def_id.to_def_id());
13331333
debug!(?id_substs);
13341334

1335+
// This zip may have several times the same lifetime in `substs` paired with a different
1336+
// lifetime from `id_substs`. In that case, we actually want to pick the last one, as it
1337+
// is the one we introduced in the impl-trait desugaring to be meaningful. The other ones
1338+
// are redundant.
13351339
let map = substs.iter().zip(id_substs);
13361340

13371341
let map: FxHashMap<GenericArg<'tcx>, GenericArg<'tcx>> = match origin {

0 commit comments

Comments
 (0)