Skip to content

Commit

Permalink
miri: fixup for allowing &raw UNSAFE_STATIC
Browse files Browse the repository at this point in the history
  • Loading branch information
workingjubilee committed Jul 22, 2024
1 parent bf454af commit b3cd9b5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/tools/miri/tests/fail/extern_static.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ extern "C" {
}

fn main() {
let _val = unsafe { std::ptr::addr_of!(FOO) }; //~ ERROR: is not supported by Miri
let _val = std::ptr::addr_of!(FOO); //~ ERROR: is not supported by Miri
}
4 changes: 2 additions & 2 deletions src/tools/miri/tests/fail/extern_static.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: unsupported operation: extern static `FOO` is not supported by Miri
--> $DIR/extern_static.rs:LL:CC
|
LL | let _val = unsafe { std::ptr::addr_of!(FOO) };
| ^^^ extern static `FOO` is not supported by Miri
LL | let _val = std::ptr::addr_of!(FOO);
| ^^^ extern static `FOO` is not supported by Miri
|
= help: this is likely not a bug in the program; it indicates that the program performed an operation that Miri does not support
= note: BACKTRACE:
Expand Down
2 changes: 1 addition & 1 deletion src/tools/miri/tests/pass/static_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::ptr::addr_of;

static mut FOO: i32 = 42;

static BAR: Foo = Foo(unsafe { addr_of!(FOO) });
static BAR: Foo = Foo(addr_of!(FOO));

#[allow(dead_code)]
struct Foo(*const i32);
Expand Down

0 comments on commit b3cd9b5

Please sign in to comment.