Declare some unconst operations as unsafe in const fn
This commit is contained in:
parent
64afc6b517
commit
aedc3a51df
17 changed files with 187 additions and 98 deletions
|
|
@ -3,6 +3,6 @@
|
|||
static FOO: i32 = 42;
|
||||
static BAR: i32 = 42;
|
||||
|
||||
static BAZ: bool = { (&FOO as *const i32) == (&BAR as *const i32) }; //~ ERROR issue #53020
|
||||
static BAZ: bool = unsafe { (&FOO as *const i32) == (&BAR as *const i32) }; //~ ERROR issue #53020
|
||||
fn main() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error[E0658]: comparing raw pointers inside static (see issue #53020)
|
||||
--> $DIR/E0395.rs:6:22
|
||||
--> $DIR/E0395.rs:6:29
|
||||
|
|
||||
LL | static BAZ: bool = { (&FOO as *const i32) == (&BAR as *const i32) }; //~ ERROR issue #53020
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | static BAZ: bool = unsafe { (&FOO as *const i32) == (&BAR as *const i32) }; //~ ERROR issue #53020
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add #![feature(const_compare_raw_pointers)] to the crate attributes to enable
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue