diff options
| author | bors <bors@rust-lang.org> | 2023-08-25 13:27:21 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-08-25 13:27:21 +0000 |
| commit | 25ed43ddf3e03835e5a2f2c25463ceea17a66ae5 (patch) | |
| tree | 1f37e9ef91cf6f9d2d24c7e396893fccb08fe6bd /compiler/rustc_const_eval/src | |
| parent | 738df13e8a73d6d95ddec81b7393b2d2a64b7e93 (diff) | |
| parent | 15a68610dd06351feac543afcd0802e6e2622ac8 (diff) | |
| download | rust-25ed43ddf3e03835e5a2f2c25463ceea17a66ae5.tar.gz rust-25ed43ddf3e03835e5a2f2c25463ceea17a66ae5.zip | |
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.
Diffstat (limited to 'compiler/rustc_const_eval/src')
| -rw-r--r-- | compiler/rustc_const_eval/src/util/alignment.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_const_eval/src/util/mod.rs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_const_eval/src/util/alignment.rs b/compiler/rustc_const_eval/src/util/alignment.rs index 4f39dad205a..c1f0ff260d2 100644 --- a/compiler/rustc_const_eval/src/util/alignment.rs +++ b/compiler/rustc_const_eval/src/util/alignment.rs @@ -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>, diff --git a/compiler/rustc_const_eval/src/util/mod.rs b/compiler/rustc_const_eval/src/util/mod.rs index 289e3422595..0aef7fa469e 100644 --- a/compiler/rustc_const_eval/src/util/mod.rs +++ b/compiler/rustc_const_eval/src/util/mod.rs @@ -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; |
