Skip to content

Commit a921a47

Browse files
committed
Auto merge of rust-lang#79945 - jackh726:existential_trait_ref, r=nikomatsakis
Move binder for dyn to each list item This essentially changes `ty::Binder<&'tcx List<ExistentialTraitRef>>` to `&'tcx List<ty::Binder<ExistentialTraitRef>>`. This is a first step in moving the `dyn Trait` representation closer to Chalk, which we've talked about in `@rust-lang/wg-traits.` r? `@nikomatsakis`
2 parents 5f6c32a + 42b267d commit a921a47

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/value_and_place.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -480,17 +480,19 @@ impl<'tcx> CPlace<'tcx> {
480480
// fn(&T) -> for<'l> fn(&'l T) is allowed
481481
}
482482
(&ty::Dynamic(from_traits, _), &ty::Dynamic(to_traits, _)) => {
483-
let from_traits = fx
484-
.tcx
485-
.normalize_erasing_late_bound_regions(ParamEnv::reveal_all(), from_traits);
486-
let to_traits = fx
487-
.tcx
488-
.normalize_erasing_late_bound_regions(ParamEnv::reveal_all(), to_traits);
489-
assert_eq!(
490-
from_traits, to_traits,
491-
"Can't write trait object of incompatible traits {:?} to place with traits {:?}\n\n{:#?}",
492-
from_traits, to_traits, fx,
493-
);
483+
for (from, to) in from_traits.iter().zip(to_traits) {
484+
let from = fx
485+
.tcx
486+
.normalize_erasing_late_bound_regions(ParamEnv::reveal_all(), from);
487+
let to = fx
488+
.tcx
489+
.normalize_erasing_late_bound_regions(ParamEnv::reveal_all(), to);
490+
assert_eq!(
491+
from, to,
492+
"Can't write trait object of incompatible traits {:?} to place with traits {:?}\n\n{:#?}",
493+
from_traits, to_traits, fx,
494+
);
495+
}
494496
// dyn for<'r> Trait<'r> -> dyn Trait<'_> is allowed
495497
}
496498
_ => {

0 commit comments

Comments
 (0)