diff options
| author | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2020-06-12 19:25:14 +0200 |
|---|---|---|
| committer | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2020-06-19 18:13:41 +0200 |
| commit | 9245ba83047b14fc7c9cef4c7d2bf37828c445b6 (patch) | |
| tree | 911fcf4d450811fdc58636c758e01948cf36bf8b /src/test/ui/error-codes | |
| parent | 72417d84fb51495a4f1d007fb2397a0b2609ab63 (diff) | |
| download | rust-9245ba83047b14fc7c9cef4c7d2bf37828c445b6.tar.gz rust-9245ba83047b14fc7c9cef4c7d2bf37828c445b6.zip | |
Remove the const_raw_ptr_comparison feature gate.
We can never supply a meaningful implementation of this. Instead, the follow up commits will create two intrinsics that approximate comparisons: * `ptr_maybe_eq` * `ptr_maybe_ne` The fact that `ptr_maybe_eq(a, b)` is not necessarily the same value as `!ptr_maybe_ne(a, b)` is a symptom of this entire problem.
Diffstat (limited to 'src/test/ui/error-codes')
| -rw-r--r-- | src/test/ui/error-codes/E0395.rs | 4 | ||||
| -rw-r--r-- | src/test/ui/error-codes/E0395.stderr | 9 |
2 files changed, 5 insertions, 8 deletions
diff --git a/src/test/ui/error-codes/E0395.rs b/src/test/ui/error-codes/E0395.rs index bbefff27d7f..28fba1d3061 100644 --- a/src/test/ui/error-codes/E0395.rs +++ b/src/test/ui/error-codes/E0395.rs @@ -1,10 +1,8 @@ -// gate-test-const_compare_raw_pointers - static FOO: i32 = 42; static BAR: i32 = 42; static BAZ: bool = unsafe { (&FOO as *const i32) == (&BAR as *const i32) }; -//~^ ERROR comparing raw pointers inside static +//~^ ERROR pointers cannot be compared in a meaningful way during const eval fn main() { } diff --git a/src/test/ui/error-codes/E0395.stderr b/src/test/ui/error-codes/E0395.stderr index 20c8622f337..748126f7440 100644 --- a/src/test/ui/error-codes/E0395.stderr +++ b/src/test/ui/error-codes/E0395.stderr @@ -1,12 +1,11 @@ -error[E0658]: comparing raw pointers inside static - --> $DIR/E0395.rs:6:29 +error: pointers cannot be compared in a meaningful way during const eval. + --> $DIR/E0395.rs:4:29 | LL | static BAZ: bool = unsafe { (&FOO as *const i32) == (&BAR as *const i32) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: see issue #53020 <https://github.com/rust-lang/rust/issues/53020> for more information - = help: add `#![feature(const_compare_raw_pointers)]` to the crate attributes to enable + = note: It is conceptually impossible for const eval to know in all cases whether two pointers are equal. While sometimes it is clear (the address of a static item is never equal to the address of another static item), comparing an integer address with any allocation's address is impossible to do at compile-time. + = note: That said, there's the `ptr_maybe_eq` intrinsic which returns `true` for all comparisons where CTFE isn't sure whether two addresses are equal. The mirror intrinsic `ptr_maybe_ne` returns `true` for all comparisons where CTFE isn't sure whether two addresses are inequal. error: aborting due to previous error -For more information about this error, try `rustc --explain E0658`. |
