]> git.lizzy.rs Git - rust.git/commitdiff
update tests to changes on rustc master
authorOliver Schneider <github35764891676564198441@oli-obk.de>
Tue, 4 Sep 2018 10:26:21 +0000 (12:26 +0200)
committerOliver Scherer <github35764891676564198441@oli-obk.de>
Thu, 25 Oct 2018 14:47:35 +0000 (16:47 +0200)
src/test/ui/consts/const-eval/const-pointer-values-in-various-types.rs
src/test/ui/consts/const-eval/const-pointer-values-in-various-types.stderr
src/test/ui/consts/const-eval/issue-52442.rs
src/test/ui/consts/const-eval/issue-52442.stderr
src/test/ui/consts/const-eval/ref_to_int_match.rs
src/test/ui/consts/const-eval/ref_to_int_match.stderr
src/test/ui/consts/const-size_of-cycle.stderr
src/test/ui/issues/issue-44415.stderr
src/test/ui/issues/issue-52023-array-size-pointer-cast.rs
src/test/ui/issues/issue-52023-array-size-pointer-cast.stderr

index 05d79a7d63393f1a07d6e6ac0821f185bc95a01d..23e1ab013ef3e991f773940cfb1908fd44ec51c3 100644 (file)
@@ -22,7 +22,7 @@ union Nonsense {
 
 fn main() {
     const I32_REF_USIZE_UNION: usize = unsafe { Nonsense { int_32_ref: &3 }.u };
-    //~^ ERROR this constant likely exhibits undefined behavior
+    //~^ ERROR it is undefined behavior to use this value
 
     const I32_REF_U8_UNION: u8 = unsafe { Nonsense { int_32_ref: &3 }.uint_8 };
     //~^ ERROR any use of this value will cause an error
@@ -34,7 +34,7 @@ fn main() {
     //~^ ERROR any use of this value will cause an error
 
     const I32_REF_U64_UNION: u64 = unsafe { Nonsense { int_32_ref: &3 }.uint_64 };
-    //~^ ERROR this constant likely exhibits undefined behavior
+    //~^ ERROR it is undefined behavior to use this value
 
     const I32_REF_U128_UNION: u128 = unsafe { Nonsense { int_32_ref: &3 }.uint_128 };
     //~^ ERROR any use of this value will cause an error
@@ -49,7 +49,7 @@ fn main() {
     //~^ ERROR any use of this value will cause an error
 
     const I32_REF_I64_UNION: i64 = unsafe { Nonsense { int_32_ref: &3 }.int_64 };
-    //~^ ERROR this constant likely exhibits undefined behavior
+    //~^ ERROR it is undefined behavior to use this value
 
     const I32_REF_I128_UNION: i128 = unsafe { Nonsense { int_32_ref: &3 }.int_128 };
     //~^ ERROR any use of this value will cause an error
@@ -58,7 +58,7 @@ fn main() {
     //~^ ERROR any use of this value will cause an error
 
     const I32_REF_F64_UNION: f64 = unsafe { Nonsense { int_32_ref: &3 }.float_64 };
-    //~^ ERROR this constant likely exhibits undefined behavior
+    //~^ ERROR it is undefined behavior to use this value
 
     const I32_REF_BOOL_UNION: bool = unsafe { Nonsense { int_32_ref: &3 }.truthy_falsey };
     //~^ ERROR any use of this value will cause an error
@@ -76,7 +76,7 @@ fn main() {
     //~^ ERROR any use of this value will cause an error
 
     const STR_U64_UNION: u64 = unsafe { Nonsense { stringy: "3" }.uint_64 };
-    //~^ ERROR this constant likely exhibits undefined behavior
+    //~^ ERROR it is undefined behavior to use this value
 
     const STR_U128_UNION: u128 = unsafe { Nonsense { stringy: "3" }.uint_128 };
     //~^ ERROR any use of this value will cause an error
@@ -91,7 +91,7 @@ fn main() {
     //~^ ERROR any use of this value will cause an error
 
     const STR_I64_UNION: i64 = unsafe { Nonsense { stringy: "3" }.int_64 };
-    //~^ ERROR this constant likely exhibits undefined behavior
+    //~^ ERROR it is undefined behavior to use this value
 
     const STR_I128_UNION: i128 = unsafe { Nonsense { stringy: "3" }.int_128 };
     //~^ ERROR any use of this value will cause an error
@@ -100,7 +100,7 @@ fn main() {
     //~^ ERROR any use of this value will cause an error
 
     const STR_F64_UNION: f64 = unsafe { Nonsense { stringy: "3" }.float_64 };
-    //~^ ERROR this constant likely exhibits undefined behavior
+    //~^ ERROR it is undefined behavior to use this value
 
     const STR_BOOL_UNION: bool = unsafe { Nonsense { stringy: "3" }.truthy_falsey };
     //~^ ERROR any use of this value will cause an error
index 7be9345b6b423c8a87f12d9c6be030488f0ca5cc..cc1db5db6915c91ca031ea8adcd19b5c238077b2 100644 (file)
@@ -1,4 +1,4 @@
-error[E0080]: this constant likely exhibits undefined behavior
+error[E0080]: it is undefined behavior to use this value
   --> $DIR/const-pointer-values-in-various-types.rs:24:5
    |
 LL |     const I32_REF_USIZE_UNION: usize = unsafe { Nonsense { int_32_ref: &3 }.u };
@@ -6,7 +6,7 @@ LL |     const I32_REF_USIZE_UNION: usize = unsafe { Nonsense { int_32_ref: &3 }
    |
    = 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: this constant cannot be used
+error: any use of this value will cause an error
   --> $DIR/const-pointer-values-in-various-types.rs:27:5
    |
 LL |     const I32_REF_U8_UNION: u8 = unsafe { Nonsense { int_32_ref: &3 }.uint_8 };
@@ -16,7 +16,7 @@ LL |     const I32_REF_U8_UNION: u8 = unsafe { Nonsense { int_32_ref: &3 }.uint_
    |
    = note: #[deny(const_err)] on by default
 
-error: this constant cannot be used
+error: any use of this value will cause an error
   --> $DIR/const-pointer-values-in-various-types.rs:30:5
    |
 LL |     const I32_REF_U16_UNION: u16 = unsafe { Nonsense { int_32_ref: &3 }.uint_16 };
@@ -24,7 +24,7 @@ LL |     const I32_REF_U16_UNION: u16 = unsafe { Nonsense { int_32_ref: &3 }.uin
    |                                             |
    |                                             a raw memory access tried to access part of a pointer value as raw bytes
 
-error: this constant cannot be used
+error: any use of this value will cause an error
   --> $DIR/const-pointer-values-in-various-types.rs:33:5
    |
 LL |     const I32_REF_U32_UNION: u32 = unsafe { Nonsense { int_32_ref: &3 }.uint_32 };
@@ -32,7 +32,7 @@ LL |     const I32_REF_U32_UNION: u32 = unsafe { Nonsense { int_32_ref: &3 }.uin
    |                                             |
    |                                             a raw memory access tried to access part of a pointer value as raw bytes
 
-error[E0080]: this constant likely exhibits undefined behavior
+error[E0080]: it is undefined behavior to use this value
   --> $DIR/const-pointer-values-in-various-types.rs:36:5
    |
 LL |     const I32_REF_U64_UNION: u64 = unsafe { Nonsense { int_32_ref: &3 }.uint_64 };
@@ -40,13 +40,13 @@ LL |     const I32_REF_U64_UNION: u64 = unsafe { Nonsense { int_32_ref: &3 }.uin
    |
    = 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: this constant cannot be used
+error: any use of this value will cause an error
   --> $DIR/const-pointer-values-in-various-types.rs:39:5
    |
 LL |     const I32_REF_U128_UNION: u128 = unsafe { Nonsense { int_32_ref: &3 }.uint_128 };
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempted to read undefined bytes
 
-error: this constant cannot be used
+error: any use of this value will cause an error
   --> $DIR/const-pointer-values-in-various-types.rs:42:5
    |
 LL |     const I32_REF_I8_UNION: i8 = unsafe { Nonsense { int_32_ref: &3 }.int_8 };
@@ -54,7 +54,7 @@ LL |     const I32_REF_I8_UNION: i8 = unsafe { Nonsense { int_32_ref: &3 }.int_8
    |                                           |
    |                                           a raw memory access tried to access part of a pointer value as raw bytes
 
-error: this constant cannot be used
+error: any use of this value will cause an error
   --> $DIR/const-pointer-values-in-various-types.rs:45:5
    |
 LL |     const I32_REF_I16_UNION: i16 = unsafe { Nonsense { int_32_ref: &3 }.int_16 };
@@ -62,7 +62,7 @@ LL |     const I32_REF_I16_UNION: i16 = unsafe { Nonsense { int_32_ref: &3 }.int
    |                                             |
    |                                             a raw memory access tried to access part of a pointer value as raw bytes
 
-error: this constant cannot be used
+error: any use of this value will cause an error
   --> $DIR/const-pointer-values-in-various-types.rs:48:5
    |
 LL |     const I32_REF_I32_UNION: i32 = unsafe { Nonsense { int_32_ref: &3 }.int_32 };
@@ -70,7 +70,7 @@ LL |     const I32_REF_I32_UNION: i32 = unsafe { Nonsense { int_32_ref: &3 }.int
    |                                             |
    |                                             a raw memory access tried to access part of a pointer value as raw bytes
 
-error[E0080]: this constant likely exhibits undefined behavior
+error[E0080]: it is undefined behavior to use this value
   --> $DIR/const-pointer-values-in-various-types.rs:51:5
    |
 LL |     const I32_REF_I64_UNION: i64 = unsafe { Nonsense { int_32_ref: &3 }.int_64 };
@@ -78,13 +78,13 @@ LL |     const I32_REF_I64_UNION: i64 = unsafe { Nonsense { int_32_ref: &3 }.int
    |
    = 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: this constant cannot be used
+error: any use of this value will cause an error
   --> $DIR/const-pointer-values-in-various-types.rs:54:5
    |
 LL |     const I32_REF_I128_UNION: i128 = unsafe { Nonsense { int_32_ref: &3 }.int_128 };
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempted to read undefined bytes
 
-error: this constant cannot be used
+error: any use of this value will cause an error
   --> $DIR/const-pointer-values-in-various-types.rs:57:5
    |
 LL |     const I32_REF_F32_UNION: f32 = unsafe { Nonsense { int_32_ref: &3 }.float_32 };
@@ -92,7 +92,7 @@ LL |     const I32_REF_F32_UNION: f32 = unsafe { Nonsense { int_32_ref: &3 }.flo
    |                                             |
    |                                             a raw memory access tried to access part of a pointer value as raw bytes
 
-error[E0080]: this constant likely exhibits undefined behavior
+error[E0080]: it is undefined behavior to use this value
   --> $DIR/const-pointer-values-in-various-types.rs:60:5
    |
 LL |     const I32_REF_F64_UNION: f64 = unsafe { Nonsense { int_32_ref: &3 }.float_64 };
@@ -100,7 +100,7 @@ LL |     const I32_REF_F64_UNION: f64 = unsafe { Nonsense { int_32_ref: &3 }.flo
    |
    = 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: this constant cannot be used
+error: any use of this value will cause an error
   --> $DIR/const-pointer-values-in-various-types.rs:63:5
    |
 LL |     const I32_REF_BOOL_UNION: bool = unsafe { Nonsense { int_32_ref: &3 }.truthy_falsey };
@@ -108,7 +108,7 @@ LL |     const I32_REF_BOOL_UNION: bool = unsafe { Nonsense { int_32_ref: &3 }.t
    |                                               |
    |                                               a raw memory access tried to access part of a pointer value as raw bytes
 
-error: this constant cannot be used
+error: any use of this value will cause an error
   --> $DIR/const-pointer-values-in-various-types.rs:66:5
    |
 LL |     const I32_REF_CHAR_UNION: char = unsafe { Nonsense { int_32_ref: &3 }.character };
@@ -116,7 +116,7 @@ LL |     const I32_REF_CHAR_UNION: char = unsafe { Nonsense { int_32_ref: &3 }.c
    |                                               |
    |                                               a raw memory access tried to access part of a pointer value as raw bytes
 
-error: this constant cannot be used
+error: any use of this value will cause an error
   --> $DIR/const-pointer-values-in-various-types.rs:69:5
    |
 LL |     const STR_U8_UNION: u8 = unsafe { Nonsense { stringy: "3" }.uint_8 };
@@ -124,7 +124,7 @@ LL |     const STR_U8_UNION: u8 = unsafe { Nonsense { stringy: "3" }.uint_8 };
    |                                       |
    |                                       a raw memory access tried to access part of a pointer value as raw bytes
 
-error: this constant cannot be used
+error: any use of this value will cause an error
   --> $DIR/const-pointer-values-in-various-types.rs:72:5
    |
 LL |     const STR_U16_UNION: u16 = unsafe { Nonsense { stringy: "3" }.uint_16 };
@@ -132,7 +132,7 @@ LL |     const STR_U16_UNION: u16 = unsafe { Nonsense { stringy: "3" }.uint_16 }
    |                                         |
    |                                         a raw memory access tried to access part of a pointer value as raw bytes
 
-error: this constant cannot be used
+error: any use of this value will cause an error
   --> $DIR/const-pointer-values-in-various-types.rs:75:5
    |
 LL |     const STR_U32_UNION: u32 = unsafe { Nonsense { stringy: "3" }.uint_32 };
@@ -140,7 +140,7 @@ LL |     const STR_U32_UNION: u32 = unsafe { Nonsense { stringy: "3" }.uint_32 }
    |                                         |
    |                                         a raw memory access tried to access part of a pointer value as raw bytes
 
-error[E0080]: this constant likely exhibits undefined behavior
+error[E0080]: it is undefined behavior to use this value
   --> $DIR/const-pointer-values-in-various-types.rs:78:5
    |
 LL |     const STR_U64_UNION: u64 = unsafe { Nonsense { stringy: "3" }.uint_64 };
@@ -148,7 +148,7 @@ LL |     const STR_U64_UNION: u64 = unsafe { Nonsense { stringy: "3" }.uint_64 }
    |
    = 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: this constant cannot be used
+error: any use of this value will cause an error
   --> $DIR/const-pointer-values-in-various-types.rs:81:5
    |
 LL |     const STR_U128_UNION: u128 = unsafe { Nonsense { stringy: "3" }.uint_128 };
@@ -156,7 +156,7 @@ LL |     const STR_U128_UNION: u128 = unsafe { Nonsense { stringy: "3" }.uint_12
    |                                           |
    |                                           a raw memory access tried to access part of a pointer value as raw bytes
 
-error: this constant cannot be used
+error: any use of this value will cause an error
   --> $DIR/const-pointer-values-in-various-types.rs:84:5
    |
 LL |     const STR_I8_UNION: i8 = unsafe { Nonsense { stringy: "3" }.int_8 };
@@ -164,7 +164,7 @@ LL |     const STR_I8_UNION: i8 = unsafe { Nonsense { stringy: "3" }.int_8 };
    |                                       |
    |                                       a raw memory access tried to access part of a pointer value as raw bytes
 
-error: this constant cannot be used
+error: any use of this value will cause an error
   --> $DIR/const-pointer-values-in-various-types.rs:87:5
    |
 LL |     const STR_I16_UNION: i16 = unsafe { Nonsense { stringy: "3" }.int_16 };
@@ -172,7 +172,7 @@ LL |     const STR_I16_UNION: i16 = unsafe { Nonsense { stringy: "3" }.int_16 };
    |                                         |
    |                                         a raw memory access tried to access part of a pointer value as raw bytes
 
-error: this constant cannot be used
+error: any use of this value will cause an error
   --> $DIR/const-pointer-values-in-various-types.rs:90:5
    |
 LL |     const STR_I32_UNION: i32 = unsafe { Nonsense { stringy: "3" }.int_32 };
@@ -180,7 +180,7 @@ LL |     const STR_I32_UNION: i32 = unsafe { Nonsense { stringy: "3" }.int_32 };
    |                                         |
    |                                         a raw memory access tried to access part of a pointer value as raw bytes
 
-error[E0080]: this constant likely exhibits undefined behavior
+error[E0080]: it is undefined behavior to use this value
   --> $DIR/const-pointer-values-in-various-types.rs:93:5
    |
 LL |     const STR_I64_UNION: i64 = unsafe { Nonsense { stringy: "3" }.int_64 };
@@ -188,7 +188,7 @@ LL |     const STR_I64_UNION: i64 = unsafe { Nonsense { stringy: "3" }.int_64 };
    |
    = 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: this constant cannot be used
+error: any use of this value will cause an error
   --> $DIR/const-pointer-values-in-various-types.rs:96:5
    |
 LL |     const STR_I128_UNION: i128 = unsafe { Nonsense { stringy: "3" }.int_128 };
@@ -196,7 +196,7 @@ LL |     const STR_I128_UNION: i128 = unsafe { Nonsense { stringy: "3" }.int_128
    |                                           |
    |                                           a raw memory access tried to access part of a pointer value as raw bytes
 
-error: this constant cannot be used
+error: any use of this value will cause an error
   --> $DIR/const-pointer-values-in-various-types.rs:99:5
    |
 LL |     const STR_F32_UNION: f32 = unsafe { Nonsense { stringy: "3" }.float_32 };
@@ -204,7 +204,7 @@ LL |     const STR_F32_UNION: f32 = unsafe { Nonsense { stringy: "3" }.float_32
    |                                         |
    |                                         a raw memory access tried to access part of a pointer value as raw bytes
 
-error[E0080]: this constant likely exhibits undefined behavior
+error[E0080]: it is undefined behavior to use this value
   --> $DIR/const-pointer-values-in-various-types.rs:102:5
    |
 LL |     const STR_F64_UNION: f64 = unsafe { Nonsense { stringy: "3" }.float_64 };
@@ -212,7 +212,7 @@ LL |     const STR_F64_UNION: f64 = unsafe { Nonsense { stringy: "3" }.float_64
    |
    = 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: this constant cannot be used
+error: any use of this value will cause an error
   --> $DIR/const-pointer-values-in-various-types.rs:105:5
    |
 LL |     const STR_BOOL_UNION: bool = unsafe { Nonsense { stringy: "3" }.truthy_falsey };
@@ -220,7 +220,7 @@ LL |     const STR_BOOL_UNION: bool = unsafe { Nonsense { stringy: "3" }.truthy_
    |                                           |
    |                                           a raw memory access tried to access part of a pointer value as raw bytes
 
-error: this constant cannot be used
+error: any use of this value will cause an error
   --> $DIR/const-pointer-values-in-various-types.rs:108:5
    |
 LL |     const STR_CHAR_UNION: char = unsafe { Nonsense { stringy: "3" }.character };
index 755dc153d405201c301cf6307e29c8d7171c1d48..8e207b712c35d2c59625e65a0ca43178d3db6d99 100644 (file)
@@ -10,4 +10,5 @@
 
 fn main() {
     [();  { &loop { break } as *const _ as usize } ]; //~ ERROR unimplemented expression type
+    //~^ ERROR it is undefined behavior to use this value
 }
index 586c9fa22cecdf279bda354dcd8d973a1d3639a4..93fc4bea5caa939f20a90403fca8ae17dd266fe4 100644 (file)
@@ -4,6 +4,15 @@ error[E0019]: constant contains unimplemented expression type
 LL |     [();  { &loop { break } as *const _ as usize } ]; //~ ERROR unimplemented expression type
    |              ^^^^^^^^^^^^^^
 
-error: aborting due to previous error
+error[E0080]: it is undefined behavior to use this value
+  --> $DIR/issue-52442.rs:12:11
+   |
+LL |     [();  { &loop { break } as *const _ as usize } ]; //~ ERROR unimplemented expression type
+   |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected the type usize
+   |
+   = 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 2 previous errors
 
-For more information about this error, try `rustc --explain E0019`.
+Some errors occurred: E0019, E0080.
+For more information about an error, try `rustc --explain E0019`.
index cb942f465e40f3c6f4d9e0ce9349118d084ee432..2254ed5d9e350fa789f1ff6bb13c538a751bbf20 100644 (file)
@@ -14,7 +14,7 @@ fn main() {
     let n: Int = 40;
     match n {
         0..=10 => {},
-        10..=BAR => {}, //~ ERROR lower range bound must be less than or equal to upper
+        10..=BAR => {}, //~ ERROR could not evaluate constant pattern
         _ => {},
     }
 }
@@ -30,4 +30,4 @@ union Foo {
 #[cfg(target_pointer_width="32")]
 type Int = u32;
 
-const BAR: Int = unsafe { Foo { r: &42 }.f };
+const BAR: Int = unsafe { Foo { r: &42 }.f }; //~ ERROR it is undefined behavior to use this value
index e82a16c066fdb7d7a1629323bef2d090358de39e..1e65a871de41fc79093c840793f6afa772f79f6e 100644 (file)
@@ -1,9 +1,17 @@
-error[E0030]: lower range bound must be less than or equal to upper
-  --> $DIR/ref_to_int_match.rs:17:9
+error[E0080]: it is undefined behavior to use this value
+  --> $DIR/ref_to_int_match.rs:33:1
    |
-LL |         10..=BAR => {}, //~ ERROR lower range bound must be less than or equal to upper
-   |         ^^ lower bound larger than upper bound
+LL | const BAR: Int = unsafe { Foo { r: &42 }.f }; //~ ERROR it is undefined behavior to use this value
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected the type u64
+   |
+   = 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: could not evaluate constant pattern
+  --> $DIR/ref_to_int_match.rs:17:14
+   |
+LL |         10..=BAR => {}, //~ ERROR could not evaluate constant pattern
+   |              ^^^
 
-error: aborting due to previous error
+error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0030`.
+For more information about this error, try `rustc --explain E0080`.
index 0c8fdfb6da2931c9be2da3e36630fb9faeb9d297..8e1e81f7735dc059c4c900e04a72cd06500f1c37 100644 (file)
@@ -1,5 +1,5 @@
 error[E0391]: cycle detected when const-evaluating + checking `Foo::bytes::{{constant}}`
-  --> $DIR/const-size_of-cycle.rs:16:17
+  --> $DIR/const-size_of-cycle.rs:14:17
    |
 LL |     bytes: [u8; std::mem::size_of::<Foo>()]
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -7,18 +7,18 @@ LL |     bytes: [u8; std::mem::size_of::<Foo>()]
 note: ...which requires const-evaluating `Foo::bytes::{{constant}}`...
   --> $SRC_DIR/libcore/mem.rs:LL:COL
    |
-LL |     unsafe { intrinsics::size_of::<T>() }
-   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |     intrinsics::size_of::<T>()
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
 note: ...which requires computing layout of `Foo`...
 note: ...which requires normalizing `ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: All }, value: [u8; _] }`...
 note: ...which requires const-evaluating + checking `Foo::bytes::{{constant}}`...
-  --> $DIR/const-size_of-cycle.rs:16:17
+  --> $DIR/const-size_of-cycle.rs:14:17
    |
 LL |     bytes: [u8; std::mem::size_of::<Foo>()]
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: ...which again requires const-evaluating + checking `Foo::bytes::{{constant}}`, completing the cycle
 note: cycle used when processing `Foo`
-  --> $DIR/const-size_of-cycle.rs:15:1
+  --> $DIR/const-size_of-cycle.rs:13:1
    |
 LL | struct Foo {
    | ^^^^^^^^^^
index 4345a5dbf43f0bcb3ff2d2860eac2dca15dfbf7f..e70dfe7ad4e0a81ff7202865f272f3ef6a7c9a24 100644 (file)
@@ -1,24 +1,24 @@
 error[E0391]: cycle detected when const-evaluating + checking `Foo::bytes::{{constant}}`
-  --> $DIR/issue-44415.rs:17:17
+  --> $DIR/issue-44415.rs:16:17
    |
 LL |     bytes: [u8; unsafe { intrinsics::size_of::<Foo>() }],
    |                 ^^^^^^
    |
 note: ...which requires const-evaluating `Foo::bytes::{{constant}}`...
-  --> $DIR/issue-44415.rs:17:26
+  --> $DIR/issue-44415.rs:16:26
    |
 LL |     bytes: [u8; unsafe { intrinsics::size_of::<Foo>() }],
    |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 note: ...which requires computing layout of `Foo`...
 note: ...which requires normalizing `ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: All }, value: [u8; _] }`...
 note: ...which requires const-evaluating + checking `Foo::bytes::{{constant}}`...
-  --> $DIR/issue-44415.rs:17:17
+  --> $DIR/issue-44415.rs:16:17
    |
 LL |     bytes: [u8; unsafe { intrinsics::size_of::<Foo>() }],
    |                 ^^^^^^
    = note: ...which again requires const-evaluating + checking `Foo::bytes::{{constant}}`, completing the cycle
 note: cycle used when processing `Foo`
-  --> $DIR/issue-44415.rs:16:1
+  --> $DIR/issue-44415.rs:15:1
    |
 LL | struct Foo {
    | ^^^^^^^^^^
index 02bed69f0d40e2e99accfb9677bbb7d6c92878d4..46cbdb6ac22dfd254d06c717bdc5d73d9422bb85 100644 (file)
@@ -10,4 +10,5 @@
 
 fn main() {
     let _ = [0; (&0 as *const i32) as usize]; //~ ERROR casting pointers to integers in constants
+    //~^ ERROR it is undefined behavior to use this value
 }
index 74270c2bef79849cb3e46c84d494e03399a00094..ba415d43a751a3c8501dee4c20b42d67d9343387 100644 (file)
@@ -6,6 +6,15 @@ LL |     let _ = [0; (&0 as *const i32) as usize]; //~ ERROR casting pointers to
    |
    = help: add #![feature(const_raw_ptr_to_usize_cast)] to the crate attributes to enable
 
-error: aborting due to previous error
+error[E0080]: it is undefined behavior to use this value
+  --> $DIR/issue-52023-array-size-pointer-cast.rs:12:17
+   |
+LL |     let _ = [0; (&0 as *const i32) as usize]; //~ ERROR casting pointers to integers in constants
+   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected the type usize
+   |
+   = 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 2 previous errors
 
-For more information about this error, try `rustc --explain E0658`.
+Some errors occurred: E0080, E0658.
+For more information about an error, try `rustc --explain E0080`.