diff options
Diffstat (limited to '')
7 files changed, 35 insertions, 51 deletions
diff --git a/src/test/ui/const-generics/min_const_generics/complex-expression.rs b/src/test/ui/const-generics/min_const_generics/complex-expression.rs index 7840989cb..8e667aeba 100644 --- a/src/test/ui/const-generics/min_const_generics/complex-expression.rs +++ b/src/test/ui/const-generics/min_const_generics/complex-expression.rs @@ -1,3 +1,4 @@ +// compile-flags: -Zdeduplicate-diagnostics=yes use std::mem::size_of; fn test<const N: usize>() {} diff --git a/src/test/ui/const-generics/min_const_generics/complex-expression.stderr b/src/test/ui/const-generics/min_const_generics/complex-expression.stderr index bf0d0f352..deabd05a6 100644 --- a/src/test/ui/const-generics/min_const_generics/complex-expression.stderr +++ b/src/test/ui/const-generics/min_const_generics/complex-expression.stderr @@ -1,5 +1,5 @@ error: generic parameters may not be used in const operations - --> $DIR/complex-expression.rs:9:38 + --> $DIR/complex-expression.rs:10:38 | LL | struct Break0<const N: usize>([u8; { N + 1 }]); | ^ cannot perform const operation using `N` @@ -8,7 +8,7 @@ LL | struct Break0<const N: usize>([u8; { N + 1 }]); = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/complex-expression.rs:12:40 + --> $DIR/complex-expression.rs:13:40 | LL | struct Break1<const N: usize>([u8; { { N } }]); | ^ cannot perform const operation using `N` @@ -17,7 +17,7 @@ LL | struct Break1<const N: usize>([u8; { { N } }]); = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/complex-expression.rs:16:17 + --> $DIR/complex-expression.rs:17:17 | LL | let _: [u8; N + 1]; | ^ cannot perform const operation using `N` @@ -26,7 +26,7 @@ LL | let _: [u8; N + 1]; = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/complex-expression.rs:21:17 + --> $DIR/complex-expression.rs:22:17 | LL | let _ = [0; N + 1]; | ^ cannot perform const operation using `N` @@ -35,7 +35,7 @@ LL | let _ = [0; N + 1]; = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/complex-expression.rs:25:45 + --> $DIR/complex-expression.rs:26:45 | LL | struct BreakTy0<T>(T, [u8; { size_of::<*mut T>() }]); | ^ cannot perform const operation using `T` @@ -44,7 +44,7 @@ LL | struct BreakTy0<T>(T, [u8; { size_of::<*mut T>() }]); = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/complex-expression.rs:28:47 + --> $DIR/complex-expression.rs:29:47 | LL | struct BreakTy1<T>(T, [u8; { { size_of::<*mut T>() } }]); | ^ cannot perform const operation using `T` @@ -53,7 +53,7 @@ LL | struct BreakTy1<T>(T, [u8; { { size_of::<*mut T>() } }]); = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/complex-expression.rs:32:32 + --> $DIR/complex-expression.rs:33:32 | LL | let _: [u8; size_of::<*mut T>() + 1]; | ^ cannot perform const operation using `T` @@ -62,14 +62,14 @@ LL | let _: [u8; size_of::<*mut T>() + 1]; = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions warning: cannot use constants which depend on generic parameters in types - --> $DIR/complex-expression.rs:37:17 + --> $DIR/complex-expression.rs:38:17 | LL | let _ = [0; size_of::<*mut T>() + 1]; | ^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(const_evaluatable_unchecked)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #76200 <https://github.com/rust-lang/rust/issues/76200> + = note: `#[warn(const_evaluatable_unchecked)]` on by default error: aborting due to 7 previous errors; 1 warning emitted diff --git a/src/test/ui/const-generics/min_const_generics/const-evaluatable-unchecked.rs b/src/test/ui/const-generics/min_const_generics/const-evaluatable-unchecked.rs index 71d13ca61..e9d868093 100644 --- a/src/test/ui/const-generics/min_const_generics/const-evaluatable-unchecked.rs +++ b/src/test/ui/const-generics/min_const_generics/const-evaluatable-unchecked.rs @@ -1,4 +1,5 @@ // check-pass +// compile-flags: -Zdeduplicate-diagnostics=yes #![allow(dead_code)] fn foo<T>() { diff --git a/src/test/ui/const-generics/min_const_generics/const-evaluatable-unchecked.stderr b/src/test/ui/const-generics/min_const_generics/const-evaluatable-unchecked.stderr index f9f6660f6..8003dfa40 100644 --- a/src/test/ui/const-generics/min_const_generics/const-evaluatable-unchecked.stderr +++ b/src/test/ui/const-generics/min_const_generics/const-evaluatable-unchecked.stderr @@ -1,15 +1,15 @@ warning: cannot use constants which depend on generic parameters in types - --> $DIR/const-evaluatable-unchecked.rs:5:9 + --> $DIR/const-evaluatable-unchecked.rs:6:9 | LL | [0; std::mem::size_of::<*mut T>()]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(const_evaluatable_unchecked)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #76200 <https://github.com/rust-lang/rust/issues/76200> + = note: `#[warn(const_evaluatable_unchecked)]` on by default warning: cannot use constants which depend on generic parameters in types - --> $DIR/const-evaluatable-unchecked.rs:16:21 + --> $DIR/const-evaluatable-unchecked.rs:17:21 | LL | let _ = [0; Self::ASSOC]; | ^^^^^^^^^^^ @@ -18,7 +18,7 @@ LL | let _ = [0; Self::ASSOC]; = note: for more information, see issue #76200 <https://github.com/rust-lang/rust/issues/76200> warning: cannot use constants which depend on generic parameters in types - --> $DIR/const-evaluatable-unchecked.rs:28:21 + --> $DIR/const-evaluatable-unchecked.rs:29:21 | LL | let _ = [0; Self::ASSOC]; | ^^^^^^^^^^^ diff --git a/src/test/ui/const-generics/min_const_generics/invalid-patterns.32bit.stderr b/src/test/ui/const-generics/min_const_generics/invalid-patterns.32bit.stderr index f5396b838..be92429e3 100644 --- a/src/test/ui/const-generics/min_const_generics/invalid-patterns.32bit.stderr +++ b/src/test/ui/const-generics/min_const_generics/invalid-patterns.32bit.stderr @@ -22,19 +22,14 @@ error[E0308]: mismatched types LL | get_flag::<42, 0x5ad>(); | ^^^^^ expected `char`, found `u8` -error[E0080]: it is undefined behavior to use this value - --> $DIR/invalid-patterns.rs:38:21 +error[E0080]: evaluation of constant value failed + --> $DIR/invalid-patterns.rs:38:32 | LL | get_flag::<false, { unsafe { char_raw.character } }>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`) - | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: 4, align: 4) { - __ __ __ __ │ ░░░░ - } + | ^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error[E0080]: it is undefined behavior to use this value - --> $DIR/invalid-patterns.rs:40:14 + --> $DIR/invalid-patterns.rs:41:14 | LL | get_flag::<{ unsafe { bool_raw.boolean } }, 'z'>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0x42, but expected a boolean @@ -45,7 +40,7 @@ LL | get_flag::<{ unsafe { bool_raw.boolean } }, 'z'>(); } error[E0080]: it is undefined behavior to use this value - --> $DIR/invalid-patterns.rs:42:14 + --> $DIR/invalid-patterns.rs:43:14 | LL | get_flag::<{ unsafe { bool_raw.boolean } }, { unsafe { char_raw.character } }>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0x42, but expected a boolean @@ -55,16 +50,11 @@ LL | get_flag::<{ unsafe { bool_raw.boolean } }, { unsafe { char_raw.character 42 │ B } -error[E0080]: it is undefined behavior to use this value - --> $DIR/invalid-patterns.rs:42:47 +error[E0080]: evaluation of constant value failed + --> $DIR/invalid-patterns.rs:43:58 | LL | get_flag::<{ unsafe { bool_raw.boolean } }, { unsafe { char_raw.character } }>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`) - | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: 4, align: 4) { - __ __ __ __ │ ░░░░ - } + | ^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error: aborting due to 8 previous errors diff --git a/src/test/ui/const-generics/min_const_generics/invalid-patterns.64bit.stderr b/src/test/ui/const-generics/min_const_generics/invalid-patterns.64bit.stderr index f5396b838..be92429e3 100644 --- a/src/test/ui/const-generics/min_const_generics/invalid-patterns.64bit.stderr +++ b/src/test/ui/const-generics/min_const_generics/invalid-patterns.64bit.stderr @@ -22,19 +22,14 @@ error[E0308]: mismatched types LL | get_flag::<42, 0x5ad>(); | ^^^^^ expected `char`, found `u8` -error[E0080]: it is undefined behavior to use this value - --> $DIR/invalid-patterns.rs:38:21 +error[E0080]: evaluation of constant value failed + --> $DIR/invalid-patterns.rs:38:32 | LL | get_flag::<false, { unsafe { char_raw.character } }>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`) - | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: 4, align: 4) { - __ __ __ __ │ ░░░░ - } + | ^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error[E0080]: it is undefined behavior to use this value - --> $DIR/invalid-patterns.rs:40:14 + --> $DIR/invalid-patterns.rs:41:14 | LL | get_flag::<{ unsafe { bool_raw.boolean } }, 'z'>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0x42, but expected a boolean @@ -45,7 +40,7 @@ LL | get_flag::<{ unsafe { bool_raw.boolean } }, 'z'>(); } error[E0080]: it is undefined behavior to use this value - --> $DIR/invalid-patterns.rs:42:14 + --> $DIR/invalid-patterns.rs:43:14 | LL | get_flag::<{ unsafe { bool_raw.boolean } }, { unsafe { char_raw.character } }>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0x42, but expected a boolean @@ -55,16 +50,11 @@ LL | get_flag::<{ unsafe { bool_raw.boolean } }, { unsafe { char_raw.character 42 │ B } -error[E0080]: it is undefined behavior to use this value - --> $DIR/invalid-patterns.rs:42:47 +error[E0080]: evaluation of constant value failed + --> $DIR/invalid-patterns.rs:43:58 | LL | get_flag::<{ unsafe { bool_raw.boolean } }, { unsafe { char_raw.character } }>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`) - | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: 4, align: 4) { - __ __ __ __ │ ░░░░ - } + | ^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error: aborting due to 8 previous errors diff --git a/src/test/ui/const-generics/min_const_generics/invalid-patterns.rs b/src/test/ui/const-generics/min_const_generics/invalid-patterns.rs index 682e0eced..13b2cca2f 100644 --- a/src/test/ui/const-generics/min_const_generics/invalid-patterns.rs +++ b/src/test/ui/const-generics/min_const_generics/invalid-patterns.rs @@ -36,10 +36,12 @@ fn main() { get_flag::<false, { unsafe { char_raw.character } }>(); - //~^ ERROR it is undefined behavior + //~^ ERROR evaluation of constant value failed + //~| uninitialized get_flag::<{ unsafe { bool_raw.boolean } }, 'z'>(); //~^ ERROR it is undefined behavior get_flag::<{ unsafe { bool_raw.boolean } }, { unsafe { char_raw.character } }>(); - //~^ ERROR it is undefined behavior + //~^ ERROR evaluation of constant value failed + //~| uninitialized //~| ERROR it is undefined behavior } |