interpret: make identity upcasts a NOP again to avoid them generating a new random vtable
This commit is contained in:
@@ -400,6 +400,12 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
|
||||
}
|
||||
(ty::Dynamic(data_a, _, ty::Dyn), ty::Dynamic(data_b, _, ty::Dyn)) => {
|
||||
let val = self.read_immediate(src)?;
|
||||
// MIR building generates odd NOP casts, prevent them from causing unexpected trouble.
|
||||
// See <https://github.com/rust-lang/rust/issues/128880>.
|
||||
// FIXME: ideally we wouldn't have to do this.
|
||||
if data_a == data_b {
|
||||
return self.write_immediate(*val, dest);
|
||||
}
|
||||
// Take apart the old pointer, and find the dynamic type.
|
||||
let (old_data, old_vptr) = val.to_scalar_pair();
|
||||
let old_data = old_data.to_pointer(self)?;
|
||||
|
||||
Reference in New Issue
Block a user