1
Fork 0

make NOP dyn casts not require anything about the vtable

This commit is contained in:
Ralf Jung 2022-08-06 17:18:59 -04:00
parent affe0d3a00
commit 3c8563abcf
6 changed files with 46 additions and 21 deletions

View file

@ -151,6 +151,7 @@ pub fn unsized_info<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
let old_info =
old_info.expect("unsized_info: missing old info for trait upcasting coercion");
if data_a.principal_def_id() == data_b.principal_def_id() {
// A NOP cast that doesn't actually change anything, should be allowed even with invalid vtables.
return old_info;
}