-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlA-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
rust/src/librustc_mir/interpret/place.rs
Line 856 in 02046a5
src.layout.details == dest.layout.details, |
&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)
Metadata
Metadata
Assignees
Labels
A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlA-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.