update tests to changes on rustc master
This commit is contained in:
parent
e6f7f4af50
commit
6a6b3309e6
10 changed files with 85 additions and 57 deletions
|
@ -22,7 +22,7 @@ union Nonsense {
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
const I32_REF_USIZE_UNION: usize = unsafe { Nonsense { int_32_ref: &3 }.u };
|
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 };
|
const I32_REF_U8_UNION: u8 = unsafe { Nonsense { int_32_ref: &3 }.uint_8 };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ 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
|
//~^ ERROR any use of this value will cause an error
|
||||||
|
|
||||||
const I32_REF_U64_UNION: u64 = unsafe { Nonsense { int_32_ref: &3 }.uint_64 };
|
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 };
|
const I32_REF_U128_UNION: u128 = unsafe { Nonsense { int_32_ref: &3 }.uint_128 };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ 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
|
//~^ ERROR any use of this value will cause an error
|
||||||
|
|
||||||
const I32_REF_I64_UNION: i64 = unsafe { Nonsense { int_32_ref: &3 }.int_64 };
|
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 };
|
const I32_REF_I128_UNION: i128 = unsafe { Nonsense { int_32_ref: &3 }.int_128 };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ 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
|
//~^ ERROR any use of this value will cause an error
|
||||||
|
|
||||||
const I32_REF_F64_UNION: f64 = unsafe { Nonsense { int_32_ref: &3 }.float_64 };
|
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 };
|
const I32_REF_BOOL_UNION: bool = unsafe { Nonsense { int_32_ref: &3 }.truthy_falsey };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ 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
|
//~^ ERROR any use of this value will cause an error
|
||||||
|
|
||||||
const STR_U64_UNION: u64 = unsafe { Nonsense { stringy: "3" }.uint_64 };
|
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 };
|
const STR_U128_UNION: u128 = unsafe { Nonsense { stringy: "3" }.uint_128 };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ 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
|
//~^ ERROR any use of this value will cause an error
|
||||||
|
|
||||||
const STR_I64_UNION: i64 = unsafe { Nonsense { stringy: "3" }.int_64 };
|
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 };
|
const STR_I128_UNION: i128 = unsafe { Nonsense { stringy: "3" }.int_128 };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ 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
|
//~^ ERROR any use of this value will cause an error
|
||||||
|
|
||||||
const STR_F64_UNION: f64 = unsafe { Nonsense { stringy: "3" }.float_64 };
|
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 };
|
const STR_BOOL_UNION: bool = unsafe { Nonsense { stringy: "3" }.truthy_falsey };
|
||||||
//~^ ERROR any use of this value will cause an error
|
//~^ ERROR any use of this value will cause an error
|
||||||
|
|
|
@ -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
|
--> $DIR/const-pointer-values-in-various-types.rs:24:5
|
||||||
|
|
|
|
||||||
LL | const I32_REF_USIZE_UNION: usize = unsafe { Nonsense { int_32_ref: &3 }.u };
|
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
|
= 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
|
--> $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 };
|
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
|
= 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
|
--> $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 };
|
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
|
| 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
|
--> $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 };
|
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
|
| 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
|
--> $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 };
|
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
|
= 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
|
--> $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 };
|
LL | const I32_REF_U128_UNION: u128 = unsafe { Nonsense { int_32_ref: &3 }.uint_128 };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempted to read undefined bytes
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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
|
--> $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 };
|
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
|
| 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
|
--> $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 };
|
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
|
| 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
|
--> $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 };
|
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
|
| 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
|
--> $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 };
|
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
|
= 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
|
--> $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 };
|
LL | const I32_REF_I128_UNION: i128 = unsafe { Nonsense { int_32_ref: &3 }.int_128 };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempted to read undefined bytes
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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
|
--> $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 };
|
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
|
| 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
|
--> $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 };
|
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
|
= 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
|
--> $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 };
|
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
|
| 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
|
--> $DIR/const-pointer-values-in-various-types.rs:66:5
|
||||||
|
|
|
|
||||||
LL | const I32_REF_CHAR_UNION: char = unsafe { Nonsense { int_32_ref: &3 }.character };
|
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
|
| 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
|
--> $DIR/const-pointer-values-in-various-types.rs:69:5
|
||||||
|
|
|
|
||||||
LL | const STR_U8_UNION: u8 = unsafe { Nonsense { stringy: "3" }.uint_8 };
|
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
|
| 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
|
--> $DIR/const-pointer-values-in-various-types.rs:72:5
|
||||||
|
|
|
|
||||||
LL | const STR_U16_UNION: u16 = unsafe { Nonsense { stringy: "3" }.uint_16 };
|
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
|
| 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
|
--> $DIR/const-pointer-values-in-various-types.rs:75:5
|
||||||
|
|
|
|
||||||
LL | const STR_U32_UNION: u32 = unsafe { Nonsense { stringy: "3" }.uint_32 };
|
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
|
| 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
|
--> $DIR/const-pointer-values-in-various-types.rs:78:5
|
||||||
|
|
|
|
||||||
LL | const STR_U64_UNION: u64 = unsafe { Nonsense { stringy: "3" }.uint_64 };
|
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
|
= 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
|
--> $DIR/const-pointer-values-in-various-types.rs:81:5
|
||||||
|
|
|
|
||||||
LL | const STR_U128_UNION: u128 = unsafe { Nonsense { stringy: "3" }.uint_128 };
|
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
|
| 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
|
--> $DIR/const-pointer-values-in-various-types.rs:84:5
|
||||||
|
|
|
|
||||||
LL | const STR_I8_UNION: i8 = unsafe { Nonsense { stringy: "3" }.int_8 };
|
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
|
| 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
|
--> $DIR/const-pointer-values-in-various-types.rs:87:5
|
||||||
|
|
|
|
||||||
LL | const STR_I16_UNION: i16 = unsafe { Nonsense { stringy: "3" }.int_16 };
|
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
|
| 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
|
--> $DIR/const-pointer-values-in-various-types.rs:90:5
|
||||||
|
|
|
|
||||||
LL | const STR_I32_UNION: i32 = unsafe { Nonsense { stringy: "3" }.int_32 };
|
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
|
| 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
|
--> $DIR/const-pointer-values-in-various-types.rs:93:5
|
||||||
|
|
|
|
||||||
LL | const STR_I64_UNION: i64 = unsafe { Nonsense { stringy: "3" }.int_64 };
|
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
|
= 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
|
--> $DIR/const-pointer-values-in-various-types.rs:96:5
|
||||||
|
|
|
|
||||||
LL | const STR_I128_UNION: i128 = unsafe { Nonsense { stringy: "3" }.int_128 };
|
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
|
| 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
|
--> $DIR/const-pointer-values-in-various-types.rs:99:5
|
||||||
|
|
|
|
||||||
LL | const STR_F32_UNION: f32 = unsafe { Nonsense { stringy: "3" }.float_32 };
|
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
|
| 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
|
--> $DIR/const-pointer-values-in-various-types.rs:102:5
|
||||||
|
|
|
|
||||||
LL | const STR_F64_UNION: f64 = unsafe { Nonsense { stringy: "3" }.float_64 };
|
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
|
= 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
|
--> $DIR/const-pointer-values-in-various-types.rs:105:5
|
||||||
|
|
|
|
||||||
LL | const STR_BOOL_UNION: bool = unsafe { Nonsense { stringy: "3" }.truthy_falsey };
|
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
|
| 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
|
--> $DIR/const-pointer-values-in-various-types.rs:108:5
|
||||||
|
|
|
|
||||||
LL | const STR_CHAR_UNION: char = unsafe { Nonsense { stringy: "3" }.character };
|
LL | const STR_CHAR_UNION: char = unsafe { Nonsense { stringy: "3" }.character };
|
||||||
|
|
|
@ -10,4 +10,5 @@
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
[(); { &loop { break } as *const _ as usize } ]; //~ ERROR unimplemented expression type
|
[(); { &loop { break } as *const _ as usize } ]; //~ ERROR unimplemented expression type
|
||||||
|
//~^ ERROR it is undefined behavior to use this value
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,15 @@ error[E0019]: constant contains unimplemented expression type
|
||||||
LL | [(); { &loop { break } as *const _ as usize } ]; //~ ERROR 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
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0019`.
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
Some errors occurred: E0019, E0080.
|
||||||
|
For more information about an error, try `rustc --explain E0019`.
|
||||||
|
|
|
@ -14,7 +14,7 @@ fn main() {
|
||||||
let n: Int = 40;
|
let n: Int = 40;
|
||||||
match n {
|
match n {
|
||||||
0..=10 => {},
|
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 @@ type Int = u64;
|
||||||
#[cfg(target_pointer_width="32")]
|
#[cfg(target_pointer_width="32")]
|
||||||
type Int = u32;
|
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
|
||||||
|
|
|
@ -1,9 +1,17 @@
|
||||||
error[E0030]: lower range bound must be less than or equal to upper
|
error[E0080]: it is undefined behavior to use this value
|
||||||
--> $DIR/ref_to_int_match.rs:17:9
|
--> $DIR/ref_to_int_match.rs:33:1
|
||||||
|
|
|
|
||||||
LL | 10..=BAR => {}, //~ ERROR lower range bound must be less than or equal to upper
|
LL | const BAR: Int = unsafe { Foo { r: &42 }.f }; //~ ERROR it is undefined behavior to use this value
|
||||||
| ^^ lower bound larger than upper bound
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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: aborting due to previous error
|
error: could not evaluate constant pattern
|
||||||
|
--> $DIR/ref_to_int_match.rs:17:14
|
||||||
|
|
|
||||||
|
LL | 10..=BAR => {}, //~ ERROR could not evaluate constant pattern
|
||||||
|
| ^^^
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0030`.
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error[E0391]: cycle detected when const-evaluating + checking `Foo::bytes::{{constant}}`
|
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>()]
|
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}}`...
|
note: ...which requires const-evaluating `Foo::bytes::{{constant}}`...
|
||||||
--> $SRC_DIR/libcore/mem.rs:LL:COL
|
--> $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 computing layout of `Foo`...
|
||||||
note: ...which requires normalizing `ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: All }, value: [u8; _] }`...
|
note: ...which requires normalizing `ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: All }, value: [u8; _] }`...
|
||||||
note: ...which requires const-evaluating + checking `Foo::bytes::{{constant}}`...
|
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>()]
|
LL | bytes: [u8; std::mem::size_of::<Foo>()]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
= note: ...which again requires const-evaluating + checking `Foo::bytes::{{constant}}`, completing the cycle
|
= note: ...which again requires const-evaluating + checking `Foo::bytes::{{constant}}`, completing the cycle
|
||||||
note: cycle used when processing `Foo`
|
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 {
|
LL | struct Foo {
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
error[E0391]: cycle detected when const-evaluating + checking `Foo::bytes::{{constant}}`
|
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>() }],
|
LL | bytes: [u8; unsafe { intrinsics::size_of::<Foo>() }],
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
|
|
|
|
||||||
note: ...which requires const-evaluating `Foo::bytes::{{constant}}`...
|
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>() }],
|
LL | bytes: [u8; unsafe { intrinsics::size_of::<Foo>() }],
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
note: ...which requires computing layout 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 normalizing `ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: All }, value: [u8; _] }`...
|
||||||
note: ...which requires const-evaluating + checking `Foo::bytes::{{constant}}`...
|
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>() }],
|
LL | bytes: [u8; unsafe { intrinsics::size_of::<Foo>() }],
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
= note: ...which again requires const-evaluating + checking `Foo::bytes::{{constant}}`, completing the cycle
|
= note: ...which again requires const-evaluating + checking `Foo::bytes::{{constant}}`, completing the cycle
|
||||||
note: cycle used when processing `Foo`
|
note: cycle used when processing `Foo`
|
||||||
--> $DIR/issue-44415.rs:16:1
|
--> $DIR/issue-44415.rs:15:1
|
||||||
|
|
|
|
||||||
LL | struct Foo {
|
LL | struct Foo {
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
|
@ -10,4 +10,5 @@
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _ = [0; (&0 as *const i32) as usize]; //~ ERROR casting pointers to integers in constants
|
let _ = [0; (&0 as *const i32) as usize]; //~ ERROR casting pointers to integers in constants
|
||||||
|
//~^ ERROR it is undefined behavior to use this value
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
= 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
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0658`.
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
Some errors occurred: E0080, E0658.
|
||||||
|
For more information about an error, try `rustc --explain E0080`.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue