Skip to content

Commit b66c447

Browse files
committed
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
2 parents bb982d7 + 2fe56b7 commit b66c447

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#![feature(custom_mir, core_intrinsics)]
2+
use std::intrinsics::mir::*;
3+
4+
#[repr(packed)]
5+
struct S { field: [u32; 2] }
6+
7+
#[custom_mir(dialect = "runtime", phase = "optimized")]
8+
fn test() { mir! {
9+
let s: S;
10+
{
11+
// Store a repeat expression directly into a field of a packed struct.
12+
s.field = [0; 2];
13+
Return()
14+
}
15+
} }
16+
17+
fn main() {
18+
// Run this a bunch of time to make sure it doesn't pass by chance.
19+
for _ in 0..20 {
20+
test();
21+
}
22+
}

tests/pass/issues/issue-miri-1925.rs renamed to tests/pass/align_repeat_into_well_aligned_array.rs

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ use std::mem::size_of;
44

55
fn main() {
66
let mut a = Params::new();
7+
// The array itself here happens to be quite well-aligned, but not all its elements have that
8+
// large alignment and we better make sure that is still accepted by Miri.
79
a.key_block = [0; BLOCKBYTES];
810
}
911

0 commit comments

Comments
 (0)