Also put comparing raw pointers behind a feature gate

This commit is contained in:
Oliver Schneider 2018-08-03 11:12:10 +02:00
parent 1fc7580a8e
commit 36907fc18d
7 changed files with 22 additions and 46 deletions

View file

@ -11,6 +11,6 @@
static FOO: i32 = 42;
static BAR: i32 = 42;
static BAZ: bool = { (&FOO as *const i32) == (&BAR as *const i32) }; //~ ERROR E0395
static BAZ: bool = { (&FOO as *const i32) == (&BAR as *const i32) }; //~ ERROR issue #53020
fn main() {
}

View file

@ -1,9 +1,11 @@
error[E0395]: raw pointers cannot be compared in statics
error[E0658]: comparing raw pointers inside static (see issue #53020)
--> $DIR/E0395.rs:14:22
|
LL | static BAZ: bool = { (&FOO as *const i32) == (&BAR as *const i32) }; //~ ERROR E0395
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comparing raw pointers in static
LL | static BAZ: bool = { (&FOO as *const i32) == (&BAR as *const i32) }; //~ ERROR issue #53020
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(const_compare_raw_pointers)] to the crate attributes to enable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0395`.
For more information about this error, try `rustc --explain E0658`.

View file

@ -11,6 +11,6 @@
fn id<T>(t: T) -> T { t }
fn main() {
const A: bool = id::<u8> as *const () < id::<u16> as *const ();
//~^ ERROR raw pointers cannot be compared in constants [E0395]
//~^ ERROR comparing raw pointers inside constant
println!("{}", A);
}

View file

@ -1,9 +1,11 @@
error[E0395]: raw pointers cannot be compared in constants
error[E0658]: comparing raw pointers inside constant (see issue #53020)
--> $DIR/issue-25826.rs:13:21
|
LL | const A: bool = id::<u8> as *const () < id::<u16> as *const ();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comparing raw pointers in static
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(const_compare_raw_pointers)] to the crate attributes to enable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0395`.
For more information about this error, try `rustc --explain E0658`.