about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-08-01 16:09:13 +0000
committerbors <bors@rust-lang.org>2023-08-01 16:09:13 +0000
commit4896daa3985010e7d136fe0c5bf4c4e8bfc911ae (patch)
tree4daf7dcc56c274b7786e104e1ecd0504b3152a6e /src
parent828bdc2c26f5c95773c4ecf72870919f16417b66 (diff)
parent41364c7c1d7142532b747100177c8b889475dde3 (diff)
downloadrust-4896daa3985010e7d136fe0c5bf4c4e8bfc911ae.tar.gz
rust-4896daa3985010e7d136fe0c5bf4c4e8bfc911ae.zip
Auto merge of #114331 - matthiaskrgr:rollup-rnrmwcx, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #100455 (Implement RefUnwindSafe for Backtrace)
 - #113428 (coverage: Replace `ExpressionOperandId` with enum `Operand`)
 - #114283 (Use parking lot's rwlock even without parallel-rustc)
 - #114288 (Improve diagnostic for wrong borrow on binary operations)
 - #114296 (interpret: fix alignment handling for Repeat expressions)
 - #114306 ([rustc_data_structures][perf] Simplify base_n::push_str.)
 - #114320 (Cover statements for stable_mir)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src')
-rw-r--r--src/tools/miri/tests/pass/align_repeat_into_packed_field.rs22
-rw-r--r--src/tools/miri/tests/pass/align_repeat_into_well_aligned_array.rs (renamed from src/tools/miri/tests/pass/issues/issue-miri-1925.rs)2
2 files changed, 24 insertions, 0 deletions
diff --git a/src/tools/miri/tests/pass/align_repeat_into_packed_field.rs b/src/tools/miri/tests/pass/align_repeat_into_packed_field.rs
new file mode 100644
index 00000000000..3affb204205
--- /dev/null
+++ b/src/tools/miri/tests/pass/align_repeat_into_packed_field.rs
@@ -0,0 +1,22 @@
+#![feature(custom_mir, core_intrinsics)]
+use std::intrinsics::mir::*;
+
+#[repr(packed)]
+struct S { field: [u32; 2] }
+
+#[custom_mir(dialect = "runtime", phase = "optimized")]
+fn test() { mir! {
+    let s: S;
+    {
+        // Store a repeat expression directly into a field of a packed struct.
+        s.field = [0; 2];
+        Return()
+    }
+} }
+
+fn main() {
+    // Run this a bunch of time to make sure it doesn't pass by chance.
+    for _ in 0..20 {
+        test();
+    }
+}
diff --git a/src/tools/miri/tests/pass/issues/issue-miri-1925.rs b/src/tools/miri/tests/pass/align_repeat_into_well_aligned_array.rs
index 86556813491..735251039f7 100644
--- a/src/tools/miri/tests/pass/issues/issue-miri-1925.rs
+++ b/src/tools/miri/tests/pass/align_repeat_into_well_aligned_array.rs
@@ -4,6 +4,8 @@ use std::mem::size_of;
 
 fn main() {
     let mut a = Params::new();
+    // The array itself here happens to be quite well-aligned, but not all its elements have that
+    // large alignment and we better make sure that is still accepted by Miri.
     a.key_block = [0; BLOCKBYTES];
 }