Skip to content

Commit afc529d

Browse files
committed
Fix assert_assignable adt checking
1 parent f545a21 commit afc529d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/value_and_place.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,19 @@ pub(crate) fn assert_assignable<'tcx>(
705705
}
706706
// dyn for<'r> Trait<'r> -> dyn Trait<'_> is allowed
707707
}
708+
(&ty::Adt(adt_def_a, substs_a), &ty::Adt(adt_def_b, substs_b))
709+
if adt_def_a.did == adt_def_b.did =>
710+
{
711+
let mut types_a = substs_a.types();
712+
let mut types_b = substs_b.types();
713+
loop {
714+
match (types_a.next(), types_b.next()) {
715+
(Some(a), Some(b)) => assert_assignable(fx, a, b),
716+
(None, None) => return,
717+
(Some(_), None) | (None, Some(_)) => panic!("{:#?}/{:#?}", from_ty, to_ty),
718+
}
719+
}
720+
}
708721
_ => {
709722
assert_eq!(
710723
from_ty, to_ty,

0 commit comments

Comments
 (0)