Skip to content

Commit e46bfb4

Browse files
authored
Merge pull request #4270 from rust-lang/rustup-2025-04-12
Automatic Rustup
2 parents 3c2d4e3 + b5204b0 commit e46bfb4

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7d7de5bf3c3cbf9c2c5bbc5cbfb9197a8a427d35
1+
1bc56185ee257ed829a0aea7abdc3b03c5fed887

src/bin/miri.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ impl rustc_driver::Callbacks for MiriCompilerCalls {
185185
let num_failed = sync::IntoDynSyncSend(AtomicU32::new(0));
186186
sync::par_for_each_in(many_seeds.seeds.clone(), |seed| {
187187
let mut config = config.clone();
188-
config.seed = Some(seed.into());
188+
config.seed = Some((*seed).into());
189189
eprintln!("Trying seed: {seed}");
190190
let return_code = miri::eval_entry(tcx, entry_def_id, entry_type, config)
191191
.unwrap_or(rustc_driver::EXIT_FAILURE);
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
use std::mem::{align_of, size_of};
2+
3+
// See <https://github.com/rust-lang/rust/issues/134713>
4+
5+
#[repr(C)]
6+
struct Foo(usize, u8);
7+
8+
fn main() {
9+
let buf1: [usize; 2] = [1000, 2000];
10+
let buf2: [usize; 2] = [3000, 4000];
11+
12+
// Foo and [usize; 2] have the same size and alignment,
13+
// so swap_nonoverlapping should treat them the same
14+
assert_eq!(size_of::<Foo>(), size_of::<[usize; 2]>());
15+
assert_eq!(align_of::<Foo>(), align_of::<[usize; 2]>());
16+
17+
let mut b1 = buf1;
18+
let mut b2 = buf2;
19+
// Safety: b1 and b2 are distinct local variables,
20+
// with the same size and alignment as Foo.
21+
unsafe {
22+
std::ptr::swap_nonoverlapping(
23+
b1.as_mut_ptr().cast::<Foo>(),
24+
b2.as_mut_ptr().cast::<Foo>(),
25+
1,
26+
);
27+
}
28+
assert_eq!(b1, buf2);
29+
assert_eq!(b2, buf1);
30+
}

0 commit comments

Comments
 (0)