Skip to content

Commit e06b473

Browse files
committed
Merge from rustc
2 parents 6ca1cbd + fab01c1 commit e06b473

15 files changed

+40
-4
lines changed

tests/fail/uninit/padding-enum.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ fn main() {
1717
assert!(matches!(*p.as_ptr(), E::None));
1818

1919
// Turns out the discriminant is (currently) stored
20-
// in the 2nd pointer, so the first half is padding.
20+
// in the 1st pointer, so the second half is padding.
2121
let c = &p as *const _ as *const u8;
22+
let padding_offset = mem::size_of::<&'static ()>();
2223
// Read a padding byte.
23-
let _val = *c.add(0);
24+
let _val = *c.add(padding_offset);
2425
//~^ERROR: uninitialized
2526
}
2627
}

tests/fail/uninit/padding-enum.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory
22
--> tests/fail/uninit/padding-enum.rs:LL:CC
33
|
4-
LL | let _val = *c.add(0);
5-
| ^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
4+
LL | let _val = *c.add(padding_offset);
5+
| ^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

tests/pass-dep/concurrency/linux-futex.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
//@only-target: linux
22
//@compile-flags: -Zmiri-disable-isolation
33

4+
// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint
5+
#![allow(static_mut_refs)]
6+
47
use std::mem::MaybeUninit;
58
use std::ptr::{self, addr_of};
69
use std::sync::atomic::AtomicI32;

tests/pass-dep/concurrency/tls_pthread_drop_order.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
//! the fallback path in `guard::key::enable`, which uses a *single* pthread_key
66
//! to manage a thread-local list of dtors to call.
77
8+
// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint
9+
#![allow(static_mut_refs)]
10+
811
use std::mem;
912
use std::ptr;
1013

tests/pass-dep/libc/libc-eventfd.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// test_race depends on a deterministic schedule.
33
//@compile-flags: -Zmiri-preemption-rate=0
44

5+
// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint
6+
#![allow(static_mut_refs)]
7+
58
use std::thread;
69

710
fn main() {

tests/pass-dep/libc/libc-pipe.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ fn test_pipe_threaded() {
7272
thread2.join().unwrap();
7373
}
7474

75+
// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint
76+
#[allow(static_mut_refs)]
7577
fn test_race() {
7678
static mut VAL: u8 = 0;
7779
let mut fds = [-1, -1];

tests/pass-dep/libc/libc-socketpair.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
//@ignore-target: windows # No libc socketpair on Windows
22
// test_race depends on a deterministic schedule.
33
//@compile-flags: -Zmiri-preemption-rate=0
4+
5+
// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint
6+
#![allow(static_mut_refs)]
7+
48
use std::thread;
59
fn main() {
610
test_socketpair();

tests/pass/atomic.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
//@revisions: stack tree
22
//@[tree]compile-flags: -Zmiri-tree-borrows
33
//@compile-flags: -Zmiri-strict-provenance
4+
45
#![feature(strict_provenance, strict_provenance_atomic_ptr)]
6+
// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint
7+
#![allow(static_mut_refs)]
8+
59
use std::sync::atomic::{
610
compiler_fence, fence, AtomicBool, AtomicIsize, AtomicPtr, AtomicU64, Ordering::*,
711
};

tests/pass/drop_on_array_elements.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(static_mut_refs)]
2+
13
struct Bar(u16); // ZSTs are tested separately
24

35
static mut DROP_COUNT: usize = 0;

tests/pass/drop_on_fat_ptr_array_elements.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(static_mut_refs)]
2+
13
trait Foo {}
24

35
struct Bar;

0 commit comments

Comments
 (0)