Skip to content

Commit 8d24b02

Browse files
committed
Auto merge of #1697 - RalfJung:rustup, r=RalfJung
rustup Cc rust-lang/rust#81551
2 parents abbdfd4 + 6f5a91f commit 8d24b02

File tree

8 files changed

+11
-15
lines changed

8 files changed

+11
-15
lines changed

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0e190206e2ff0c13d64701d9b4145bf89a2d0cab
1+
9b3242982202707be2485b1e4cf5f3b34466a38d
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
// Make sure we find these even with many checks disabled.
22
// compile-flags: -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation
3-
#![feature(raw_ref_macros)]
43
use std::ptr;
54

65
fn main() {
76
let p = {
87
let b = Box::new(42);
98
&*b as *const i32
109
};
11-
let x = unsafe { ptr::raw_const!(*p) }; //~ ERROR dereferenced after this allocation got freed
10+
let x = unsafe { ptr::addr_of!(*p) }; //~ ERROR dereferenced after this allocation got freed
1211
panic!("this should never print: {:?}", x);
1312
}

tests/compile-fail/extern_static.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
#![feature(raw_ref_op)]
21
//! Even referencing an unknown `extern static` already triggers an error.
32
43
extern "C" {
54
static mut FOO: i32;
65
}
76

87
fn main() {
9-
let _val = unsafe { &raw const FOO }; //~ ERROR is not supported by Miri
8+
let _val = unsafe { std::ptr::addr_of!(FOO) }; //~ ERROR is not supported by Miri
109
}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// This should fail even without validation or Stacked Borrows.
22
// compile-flags: -Zmiri-disable-validation -Zmiri-disable-stacked-borrows
3-
#![feature(raw_ref_macros)]
43
use std::ptr;
54

65
fn main() {
@@ -9,6 +8,6 @@ fn main() {
98
let x = &x[0] as *const _ as *const u32;
109
// This must fail because alignment is violated: the allocation's base is not sufficiently aligned.
1110
// The deref is UB even if we just put the result into a raw pointer.
12-
let _x = unsafe { ptr::raw_const!(*x) }; //~ ERROR memory with alignment 2, but alignment 4 is required
11+
let _x = unsafe { ptr::addr_of!(*x) }; //~ ERROR memory with alignment 2, but alignment 4 is required
1312
}
1413
}

tests/run-pass/issue-73223.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ fn main() {
44
assert_eq!(state.rest(path), "some/more");
55
}
66

7+
#[allow(unused)]
78
struct State {
89
prev: Option<usize>,
910
next: Option<usize>,

tests/run-pass/many_shr_bor.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Make sure validation can handle many overlapping shared borrows for different parts of a data structure
22
use std::cell::RefCell;
33

4+
#[allow(unused)]
45
struct Test {
56
a: u32,
67
b: u32,

tests/run-pass/packed_struct.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(unsize, coerce_unsized, raw_ref_op, raw_ref_macros)]
1+
#![feature(unsize, coerce_unsized)]
22

33
use std::collections::hash_map::DefaultHasher;
44
use std::hash::Hash;
@@ -45,10 +45,8 @@ fn test_basic() {
4545
assert_eq!({x.a}, 42);
4646
assert_eq!({x.b}, 99);
4747
// but we *can* take a raw pointer!
48-
assert_eq!(unsafe { (&raw const x.a).read_unaligned() }, 42);
49-
assert_eq!(unsafe { ptr::raw_const!(x.a).read_unaligned() }, 42);
50-
assert_eq!(unsafe { (&raw const x.b).read_unaligned() }, 99);
51-
assert_eq!(unsafe { ptr::raw_const!(x.b).read_unaligned() }, 99);
48+
assert_eq!(unsafe { ptr::addr_of!(x.a).read_unaligned() }, 42);
49+
assert_eq!(unsafe { ptr::addr_of!(x.b).read_unaligned() }, 99);
5250

5351
x.b = 77;
5452
assert_eq!({x.b}, 77);

tests/run-pass/stacked-borrows/stacked-borrows.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// compile-flags: -Zmiri-track-raw-pointers
2-
#![feature(raw_ref_macros)]
32
use std::ptr;
43

54
// Test various stacked-borrows-related things.
@@ -169,8 +168,8 @@ fn raw_ref_to_part() {
169168
}
170169

171170
let it = Box::new(Whole { part: Part { _lame: 0 }, extra: 42 });
172-
let whole = ptr::raw_mut!(*Box::leak(it));
173-
let part = unsafe { ptr::raw_mut!((*whole).part) };
171+
let whole = ptr::addr_of_mut!(*Box::leak(it));
172+
let part = unsafe { ptr::addr_of_mut!((*whole).part) };
174173
let typed = unsafe { &mut *(part as *mut Whole) };
175174
assert!(typed.extra == 42);
176175
drop(unsafe { Box::from_raw(whole) });

0 commit comments

Comments
 (0)