diff options
| author | Rémy Rakic <remy.rakic+github@gmail.com> | 2021-05-27 22:42:07 +0200 |
|---|---|---|
| committer | Rémy Rakic <remy.rakic+github@gmail.com> | 2021-05-28 00:17:47 +0200 |
| commit | c31ca9a42c0dd8a8c16b74c9db3f5376aabfcc81 (patch) | |
| tree | 60a4d6b457d894077c9fc0352ba7c862fac10dce /src/test/ui/const-generics | |
| parent | 949aca6eebf974939ebda84549ee79ecbeb84811 (diff) | |
| download | rust-c31ca9a42c0dd8a8c16b74c9db3f5376aabfcc81.tar.gz rust-c31ca9a42c0dd8a8c16b74c9db3f5376aabfcc81.zip | |
const eval errors: display the current item instance if there are generics involved
Diffstat (limited to 'src/test/ui/const-generics')
5 files changed, 9 insertions, 8 deletions
diff --git a/src/test/ui/const-generics/const_evaluatable_checked/from-sig-fail.rs b/src/test/ui/const-generics/const_evaluatable_checked/from-sig-fail.rs index 3da4688702c..8167d785d7a 100644 --- a/src/test/ui/const-generics/const_evaluatable_checked/from-sig-fail.rs +++ b/src/test/ui/const-generics/const_evaluatable_checked/from-sig-fail.rs @@ -2,7 +2,7 @@ #![allow(incomplete_features)] fn test<const N: usize>() -> [u8; N - 1] { - //~^ ERROR evaluation of constant + //~^ ERROR evaluation of `test::<0_usize>::{constant#0}` failed todo!() } diff --git a/src/test/ui/const-generics/const_evaluatable_checked/from-sig-fail.stderr b/src/test/ui/const-generics/const_evaluatable_checked/from-sig-fail.stderr index 25af18eb162..31ccf979694 100644 --- a/src/test/ui/const-generics/const_evaluatable_checked/from-sig-fail.stderr +++ b/src/test/ui/const-generics/const_evaluatable_checked/from-sig-fail.stderr @@ -1,4 +1,4 @@ -error[E0080]: evaluation of constant value failed +error[E0080]: evaluation of `test::<0_usize>::{constant#0}` failed --> $DIR/from-sig-fail.rs:4:35 | LL | fn test<const N: usize>() -> [u8; N - 1] { diff --git a/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.full.stderr b/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.full.stderr index acf0a52ce5b..1f2313a6028 100644 --- a/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.full.stderr +++ b/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.full.stderr @@ -1,10 +1,10 @@ -error[E0080]: evaluation of constant value failed - --> $DIR/simple_fail.rs:9:48 +error[E0080]: evaluation of `test::<0_usize>::{constant#0}` failed + --> $DIR/simple_fail.rs:10:48 | LL | fn test<const N: usize>() -> Arr<N> where [u8; N - 1]: Sized { | ^^^^^ attempt to compute `0_usize - 1_usize`, which would overflow -error[E0080]: evaluation of constant value failed +error[E0080]: evaluation of `Arr::<0_usize>::{constant#0}` failed --> $DIR/simple_fail.rs:6:33 | LL | type Arr<const N: usize> = [u8; N - 1]; diff --git a/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.min.stderr b/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.min.stderr index fe5463f8acc..1aa66f9a8ba 100644 --- a/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.min.stderr +++ b/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.min.stderr @@ -8,7 +8,7 @@ LL | type Arr<const N: usize> = [u8; N - 1]; = help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/simple_fail.rs:9:48 + --> $DIR/simple_fail.rs:10:48 | LL | fn test<const N: usize>() -> Arr<N> where [u8; N - 1]: Sized { | ^ cannot perform const operation using `N` diff --git a/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.rs b/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.rs index c9535d04244..f08d2495b4d 100644 --- a/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.rs +++ b/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.rs @@ -3,12 +3,13 @@ #![cfg_attr(full, feature(const_evaluatable_checked))] #![allow(incomplete_features)] -type Arr<const N: usize> = [u8; N - 1]; //[full]~ ERROR evaluation of constant +type Arr<const N: usize> = [u8; N - 1]; //[min]~^ ERROR generic parameters may not be used in const operations +//[full]~^^ ERROR evaluation of `Arr::<0_usize>::{constant#0}` failed fn test<const N: usize>() -> Arr<N> where [u8; N - 1]: Sized { //[min]~^ ERROR generic parameters may not be used in const operations -//[full]~^^ ERROR evaluation of constant +//[full]~^^ ERROR evaluation of `test::<0_usize>::{constant#0}` failed todo!() } |
