|
src.layout.details == dest.layout.details, |
just checks whether the layout of the target and value of an assignment is the same. The only time the types can differ is when assigning a
&mut T to a
&T variable. We should instead employ a function like
fn mir_assign_valid_types(dst: Ty<'tcx>, src: Ty<'tcx>) {
dst == src || match (&dst.kind, &src.kind) {
(ty::Ref(_, _, dst_pointee), ty::Ref(_, _, src_pointee)) => dst_pointee == src_pointee,
_ => false,
}
}
(source #69700 (comment))
be sure to also add appropriate mutability checks to the patterns (mutable for the source, immutable for the dest)
rust/src/librustc_mir/interpret/place.rs
Line 856 in 02046a5
&mut Tto a&Tvariable. We should instead employ a function like(source #69700 (comment))
be sure to also add appropriate mutability checks to the patterns (mutable for the source, immutable for the dest)