Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 639f660

Browse files
committed
Manual adjustments
1 parent 7d09004 commit 639f660

11 files changed

+56
-51
lines changed

tests/fail/branchless-select-i128-pointer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fn main() {
1212
// However, it drops provenance when transmuting to TwoPtrs, so this is UB.
1313
let val = unsafe {
1414
transmute::<_, &str>(
15-
//~ERROR type validation failed: encountered a dangling reference
15+
//~^ ERROR type validation failed: encountered a dangling reference
1616
!mask & transmute::<_, TwoPtrs>("false !")
1717
| mask & transmute::<_, TwoPtrs>("true !"),
1818
)

tests/fail/data_race/dealloc_read_race1.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,17 @@ pub fn main() {
1818
let ptr = EvilSend(pointer);
1919

2020
unsafe {
21-
let j1 = spawn(move || *ptr.0);
21+
let j1 = spawn(move || {
22+
let _val = *ptr.0;
23+
});
2224

2325
let j2 = spawn(move || {
2426
__rust_dealloc(
27+
//~^ ERROR Data race detected between Deallocate on Thread(id = 2) and Read on Thread(id = 1)
2528
ptr.0 as *mut _,
2629
std::mem::size_of::<usize>(),
2730
std::mem::align_of::<usize>(),
28-
); //~ ERROR Data race detected between Deallocate on Thread(id = 2) and Read on Thread(id = 1)
31+
);
2932
});
3033

3134
j1.join().unwrap();

tests/fail/data_race/dealloc_write_race1.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ pub fn main() {
2323

2424
let j2 = spawn(move || {
2525
__rust_dealloc(
26+
//~^ ERROR Data race detected between Deallocate on Thread(id = 2) and Write on Thread(id = 1)
2627
ptr.0 as *mut _,
2728
std::mem::size_of::<usize>(),
2829
std::mem::align_of::<usize>(),
29-
); //~ ERROR Data race detected between Deallocate on Thread(id = 2) and Write on Thread(id = 1)
30+
);
3031
});
3132

3233
j1.join().unwrap();

tests/fail/function_calls/check_callback_abi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ fn main() {
99
// Make sure we check the ABI when Miri itself invokes a function
1010
// as part of a shim implementation.
1111
std::intrinsics::r#try(
12-
//~ ERROR calling a function with ABI C using caller ABI Rust
12+
//~^ ERROR calling a function with ABI C using caller ABI Rust
1313
std::mem::transmute::<extern "C" fn(*mut u8), _>(try_fn),
1414
std::ptr::null_mut(),
1515
|_, _| unreachable!(),

tests/fail/function_calls/exported_symbol_abi_mismatch.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,25 @@ fn main() {
1111

1212
#[cfg(fn_ptr)]
1313
unsafe {
14-
std::mem::transmute::<unsafe fn(), unsafe extern "C" fn()>(foo)()
14+
std::mem::transmute::<unsafe fn(), unsafe extern "C" fn()>(foo)();
15+
//[fn_ptr]~^ ERROR calling a function with calling convention Rust using calling convention C
1516
}
16-
//[fn_ptr]~^ ERROR calling a function with calling convention Rust using calling convention C
1717

1818
// `Instance` caching should not suppress ABI check.
1919
#[cfg(cache)]
2020
unsafe {
21-
foo()
21+
foo();
2222
}
2323

2424
{
2525
#[cfg_attr(any(cache, fn_ptr), allow(clashing_extern_declarations))]
2626
extern "C" {
2727
fn foo();
2828
}
29-
unsafe { foo() }
30-
//[no_cache]~^ ERROR calling a function with calling convention Rust using calling convention C
31-
//[cache]~^^ ERROR calling a function with calling convention Rust using calling convention C
29+
unsafe {
30+
foo();
31+
//[no_cache]~^ ERROR calling a function with calling convention Rust using calling convention C
32+
//[cache]~| ERROR calling a function with calling convention Rust using calling convention C
33+
}
3234
}
3335
}

tests/fail/type-too-large.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// ignore-32bit
22

33
fn main() {
4-
let _fat: [u8; (1 << 61) + (1 << 31)] = [0; (1u64 << 61) as usize + (1u64 << 31) as usize]; //~ ERROR post-monomorphization error
4+
let _fat: [u8; (1 << 61) + (1 << 31)];
5+
_fat = [0; (1u64 << 61) as usize + (1u64 << 31) as usize]; //~ ERROR post-monomorphization error
56
}

tests/fail/validity/invalid_char.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
fn main() {
22
assert!(std::char::from_u32(-1_i32 as u32).is_none());
33
let _val = match unsafe { std::mem::transmute::<i32, char>(-1) } {
4-
//~ ERROR encountered 0xffffffff, but expected a valid unicode scalar value
4+
//~^ ERROR encountered 0xffffffff, but expected a valid unicode scalar value
55
'a' => true,
66
'b' => false,
77
_ => true,

tests/pass/0weak_memory_consistency.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ fn test_corr() {
5454
x.store(2, Relaxed);
5555
});
5656

57+
#[rustfmt::skip]
5758
let j2 = spawn(move || {
5859
let r2 = x.load(Relaxed); // -------------------------------------+
5960
y.store(1, Release); // ---------------------+ |
6061
r2 // | |
6162
}); // | |
62-
// |synchronizes-with |happens-before
63-
let j3 = spawn(move || {
64-
// | |
63+
#[rustfmt::skip] // |synchronizes-with |happens-before
64+
let j3 = spawn(move || { // | |
6565
acquires_value(&y, 1); // <------------------+ |
6666
x.load(Relaxed) // <----------------------------------------------+
6767
// The two reads on x are ordered by hb, so they cannot observe values
@@ -81,18 +81,17 @@ fn test_wrc() {
8181
let x = static_atomic(0);
8282
let y = static_atomic(0);
8383

84+
#[rustfmt::skip]
8485
let j1 = spawn(move || {
8586
x.store(1, Release); // ---------------------+---------------------+
8687
}); // | |
87-
// |synchronizes-with |
88-
let j2 = spawn(move || {
89-
// | |
88+
#[rustfmt::skip] // |synchronizes-with |
89+
let j2 = spawn(move || { // | |
9090
acquires_value(&x, 1); // <------------------+ |
9191
y.store(1, Release); // ---------------------+ |happens-before
9292
}); // | |
93-
// |synchronizes-with |
94-
let j3 = spawn(move || {
95-
// | |
93+
#[rustfmt::skip] // |synchronizes-with |
94+
let j3 = spawn(move || { // | |
9695
acquires_value(&y, 1); // <------------------+ |
9796
x.load(Relaxed) // <-----------------------------------------------+
9897
});
@@ -110,13 +109,13 @@ fn test_message_passing() {
110109
let x = EvilSend(ptr);
111110
let y = static_atomic(0);
112111

112+
#[rustfmt::skip]
113113
let j1 = spawn(move || {
114114
unsafe { *x.0 = 1 }; // -----------------------------------------+
115115
y.store(1, Release); // ---------------------+ |
116116
}); // | |
117-
// |synchronizes-with | happens-before
118-
let j2 = spawn(move || {
119-
// | |
117+
#[rustfmt::skip] // |synchronizes-with | happens-before
118+
let j2 = spawn(move || { // | |
120119
acquires_value(&y, 1); // <------------------+ |
121120
unsafe { *x.0 } // <---------------------------------------------+
122121
});

tests/pass/concurrency/linux-futex.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ fn wake_nobody() {
1616

1717
// Wake 1 waiter. Expect zero waiters woken up, as nobody is waiting.
1818
unsafe {
19-
assert_eq!(libc::syscall(libc::SYS_futex, &futex as *const i32, libc::FUTEX_WAKE, 1,), 0);
19+
assert_eq!(libc::syscall(libc::SYS_futex, &futex as *const i32, libc::FUTEX_WAKE, 1), 0);
2020
}
2121

2222
// Same, but without omitting the unused arguments.
@@ -31,7 +31,7 @@ fn wake_nobody() {
3131
0usize,
3232
0,
3333
),
34-
0
34+
0,
3535
);
3636
}
3737
}
@@ -43,7 +43,7 @@ fn wake_dangling() {
4343

4444
// Wake 1 waiter. Expect zero waiters woken up, as nobody is waiting.
4545
unsafe {
46-
assert_eq!(libc::syscall(libc::SYS_futex, ptr, libc::FUTEX_WAKE, 1,), 0);
46+
assert_eq!(libc::syscall(libc::SYS_futex, ptr, libc::FUTEX_WAKE, 1), 0);
4747
}
4848
}
4949

@@ -60,7 +60,7 @@ fn wait_wrong_val() {
6060
456,
6161
ptr::null::<libc::timespec>(),
6262
),
63-
-1
63+
-1,
6464
);
6565
assert_eq!(*libc::__errno_location(), libc::EAGAIN);
6666
}
@@ -81,7 +81,7 @@ fn wait_timeout() {
8181
123,
8282
&libc::timespec { tv_sec: 0, tv_nsec: 200_000_000 },
8383
),
84-
-1
84+
-1,
8585
);
8686
assert_eq!(*libc::__errno_location(), libc::ETIMEDOUT);
8787
}
@@ -120,7 +120,7 @@ fn wait_absolute_timeout() {
120120
0usize,
121121
u32::MAX,
122122
),
123-
-1
123+
-1,
124124
);
125125
assert_eq!(*libc::__errno_location(), libc::ETIMEDOUT);
126126
}
@@ -143,8 +143,8 @@ fn wait_wake() {
143143
libc::FUTEX_WAKE,
144144
10, // Wake up at most 10 threads.
145145
),
146-
1
147-
); // Woken up one thread.
146+
1, // Woken up one thread.
147+
);
148148
}
149149
});
150150

@@ -157,7 +157,7 @@ fn wait_wake() {
157157
0,
158158
ptr::null::<libc::timespec>(),
159159
),
160-
0
160+
0,
161161
);
162162
}
163163

@@ -183,8 +183,8 @@ fn wait_wake_bitset() {
183183
0usize,
184184
0b1001, // bitset
185185
),
186-
0
187-
); // Didn't match any thread.
186+
0, // Didn't match any thread.
187+
);
188188
}
189189
thread::sleep(Duration::from_millis(200));
190190
unsafe {
@@ -198,8 +198,8 @@ fn wait_wake_bitset() {
198198
0usize,
199199
0b0110, // bitset
200200
),
201-
1
202-
); // Woken up one thread.
201+
1, // Woken up one thread.
202+
);
203203
}
204204
});
205205

@@ -214,7 +214,7 @@ fn wait_wake_bitset() {
214214
0usize,
215215
0b0100, // bitset
216216
),
217-
0
217+
0,
218218
);
219219
}
220220

tests/pass/heap_allocator.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ fn check_alloc<T: Allocator>(allocator: T) {
1616
assert_eq!(
1717
a.as_ptr() as usize % layout_20.align(),
1818
0,
19-
"pointer is incorrectly aligned"
19+
"pointer is incorrectly aligned",
2020
);
2121
allocator.deallocate(a, layout_20);
2222
}
@@ -25,7 +25,7 @@ fn check_alloc<T: Allocator>(allocator: T) {
2525
assert_eq!(
2626
p1.as_ptr() as usize % layout_20.align(),
2727
0,
28-
"pointer is incorrectly aligned"
28+
"pointer is incorrectly aligned",
2929
);
3030
assert_eq!(*p1.as_ptr(), 0);
3131

@@ -34,7 +34,7 @@ fn check_alloc<T: Allocator>(allocator: T) {
3434
assert_eq!(
3535
p2.as_ptr() as usize % layout_40.align(),
3636
0,
37-
"pointer is incorrectly aligned"
37+
"pointer is incorrectly aligned",
3838
);
3939
let slice = slice::from_raw_parts(p2.as_ptr(), 20);
4040
assert_eq!(&slice, &[0_u8; 20]);
@@ -44,7 +44,7 @@ fn check_alloc<T: Allocator>(allocator: T) {
4444
assert_eq!(
4545
p3.as_ptr() as usize % layout_40.align(),
4646
0,
47-
"pointer is incorrectly aligned"
47+
"pointer is incorrectly aligned",
4848
);
4949
let slice = slice::from_raw_parts(p3.as_ptr(), 20);
5050
assert_eq!(&slice, &[0_u8; 20]);
@@ -54,7 +54,7 @@ fn check_alloc<T: Allocator>(allocator: T) {
5454
assert_eq!(
5555
p4.as_ptr() as usize % layout_10.align(),
5656
0,
57-
"pointer is incorrectly aligned"
57+
"pointer is incorrectly aligned",
5858
);
5959
let slice = slice::from_raw_parts(p4.as_ptr(), 10);
6060
assert_eq!(&slice, &[0_u8; 10]);
@@ -65,10 +65,9 @@ fn check_alloc<T: Allocator>(allocator: T) {
6565
}
6666

6767
fn check_align_requests<T: Allocator>(allocator: T) {
68-
for &size in &[2, 8, 64] {
69-
// size less than and bigger than alignment
70-
for &align in &[4, 8, 16, 32] {
71-
// Be sure to cover less than and bigger than `MIN_ALIGN` for all architectures
68+
#[rustfmt::skip] // https://github.com/rust-lang/rustfmt/issues/3255
69+
for &size in &[2, 8, 64] { // size less than and bigger than alignment
70+
for &align in &[4, 8, 16, 32] { // Be sure to cover less than and bigger than `MIN_ALIGN` for all architectures
7271
let iterations = 32;
7372
unsafe {
7473
let pointers: Vec<_> = (0..iterations)
@@ -83,7 +82,7 @@ fn check_align_requests<T: Allocator>(allocator: T) {
8382
assert_eq!(
8483
(ptr.as_ptr() as usize) % align,
8584
0,
86-
"Got a pointer less aligned than requested"
85+
"Got a pointer less aligned than requested",
8786
)
8887
}
8988

@@ -93,7 +92,7 @@ fn check_align_requests<T: Allocator>(allocator: T) {
9392
}
9493
}
9594
}
96-
}
95+
};
9796
}
9897

9998
fn global_to_box() {

tests/pass/iter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
fn iter_empty_and_zst() {
2+
// Iterate over a Unique::empty()
23
for _ in Vec::<u32>::new().iter() {
3-
// this iterates over a Unique::empty()
44
panic!("We should never be here.");
55
}
66

0 commit comments

Comments
 (0)