1
Fork 0

Auto merge of #115138 - cjgillot:dse-move-packed, r=compiler-errors

Do not convert copies of packed projections to moves.

This code path was introduced in https://github.com/rust-lang/rust/pull/113758

After seeing https://rust-lang.zulipchat.com/#narrow/stream/136281-t-opsem/topic/Packed.20fields.20and.20in-place.20function.20argument.2Freturn.20passing, this may be UB, so should be disallowed.

This should not appear in normally-built MIR, which introduces temporary copies for packed projections.
This commit is contained in:
bors 2023-08-25 13:27:21 +00:00
commit 25ed43ddf3
6 changed files with 64 additions and 2 deletions

View file

@ -40,7 +40,7 @@ where
}
}
fn is_within_packed<'tcx, L>(
pub fn is_within_packed<'tcx, L>(
tcx: TyCtxt<'tcx>,
local_decls: &L,
place: Place<'tcx>,

View file

@ -5,7 +5,7 @@ mod check_validity_requirement;
mod compare_types;
mod type_name;
pub use self::alignment::is_disaligned;
pub use self::alignment::{is_disaligned, is_within_packed};
pub use self::check_validity_requirement::check_validity_requirement;
pub use self::compare_types::{is_equal_up_to_subtyping, is_subtype};
pub use self::type_name::type_name;