about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorOliver Schneider <github35764891676564198441@oli-obk.de>2018-08-02 10:19:37 +0200
committerOliver Schneider <github35764891676564198441@oli-obk.de>2018-08-02 10:19:37 +0200
commitc8e30c429503de90f7bad8a4c336af11ffaa48e6 (patch)
treed00cbcf2d7e1f61fee4e9aa8adbfae23b63cee95 /src/test
parent2c836a7ebd3b32bff4c78daeb04ac4a5fe0fa165 (diff)
downloadrust-c8e30c429503de90f7bad8a4c336af11ffaa48e6.tar.gz
rust-c8e30c429503de90f7bad8a4c336af11ffaa48e6.zip
Reading values should not be looking at the variant
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/const-eval/ub-enum-ptr.rs2
-rw-r--r--src/test/ui/const-eval/ub-enum-ptr.stderr7
2 files changed, 5 insertions, 4 deletions
diff --git a/src/test/ui/const-eval/ub-enum-ptr.rs b/src/test/ui/const-eval/ub-enum-ptr.rs
index 66eda13a734..8538dd14afe 100644
--- a/src/test/ui/const-eval/ub-enum-ptr.rs
+++ b/src/test/ui/const-eval/ub-enum-ptr.rs
@@ -21,7 +21,7 @@ union Foo {
 
 // A pointer is guaranteed non-null
 const BAD_ENUM: Enum = unsafe { Foo { a: &1 }.b};
-//~^ ERROR this constant cannot be used
+//~^ ERROR this constant likely exhibits undefined behavior
 
 fn main() {
 }
diff --git a/src/test/ui/const-eval/ub-enum-ptr.stderr b/src/test/ui/const-eval/ub-enum-ptr.stderr
index a0aa459db3f..4b7ccc25c6c 100644
--- a/src/test/ui/const-eval/ub-enum-ptr.stderr
+++ b/src/test/ui/const-eval/ub-enum-ptr.stderr
@@ -1,10 +1,11 @@
-error: this constant cannot be used
+error[E0080]: this constant likely exhibits undefined behavior
   --> $DIR/ub-enum-ptr.rs:23:1
    |
 LL | const BAD_ENUM: Enum = unsafe { Foo { a: &1 }.b};
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ a raw memory access tried to access part of a pointer value as raw bytes
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered pointer at .TAG, but expected something in the range 0..=0
    |
-   = note: #[deny(const_err)] on by default
+   = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
 error: aborting due to previous error
 
+For more information about this error, try `rustc --explain E0080`.