diff options
| author | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2020-06-20 13:25:55 +0200 |
|---|---|---|
| committer | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2020-06-20 14:09:07 +0200 |
| commit | 9e88b48133c703c04780a9474c029b4398ca3260 (patch) | |
| tree | 17135c4aeba98a76df77634176c6b33d6262cecc /src/test/ui/error-codes | |
| parent | 84f1d73182f4882518d5eef067b18b49b49e985a (diff) | |
| download | rust-9e88b48133c703c04780a9474c029b4398ca3260.tar.gz rust-9e88b48133c703c04780a9474c029b4398ca3260.zip | |
Refer just to the issue in the raw ptr cmp diagnostic instead of explaining everything in the diagnostic
Diffstat (limited to 'src/test/ui/error-codes')
| -rw-r--r-- | src/test/ui/error-codes/E0395.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/error-codes/E0395.stderr | 4 |
2 files changed, 2 insertions, 4 deletions
diff --git a/src/test/ui/error-codes/E0395.rs b/src/test/ui/error-codes/E0395.rs index 28fba1d3061..d2edd97efb2 100644 --- a/src/test/ui/error-codes/E0395.rs +++ b/src/test/ui/error-codes/E0395.rs @@ -2,7 +2,7 @@ static FOO: i32 = 42; static BAR: i32 = 42; static BAZ: bool = unsafe { (&FOO as *const i32) == (&BAR as *const i32) }; -//~^ ERROR pointers cannot be compared in a meaningful way during const eval +//~^ ERROR pointers cannot be reliably compared during const eval fn main() { } diff --git a/src/test/ui/error-codes/E0395.stderr b/src/test/ui/error-codes/E0395.stderr index 62949cf15e1..674cc696450 100644 --- a/src/test/ui/error-codes/E0395.stderr +++ b/src/test/ui/error-codes/E0395.stderr @@ -1,12 +1,10 @@ -error: pointers cannot be compared in a meaningful way during const eval. +error: pointers cannot be reliably compared 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 - = 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 non-zst static item is never equal to the address of another non-zst static item), comparing an integer address with any allocation's address is impossible to do at compile-time. - = note: That said, there's the `<*const T>::guaranteed_eq` intrinsic which returns `true` for all comparisons where CTFE is sure that two addresses are equal. The mirror intrinsic `<*const T>::guaranteed_ne` returns `true` for all comparisons where CTFE is sure that two addresses are inequal. error: aborting due to previous error |
