diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-05-25 12:54:34 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-25 12:54:34 +0200 |
| commit | 7ea507e0415deedf8ba7d477ef0fba4da9c90ae2 (patch) | |
| tree | 81432fdb4244c59e4093ce8baf11169d8b22910f /tests/ui/const-generics/generic_const_exprs | |
| parent | f28d36899c1e914bd8e994c8f526da70a0ed1073 (diff) | |
| parent | d5eb7a71b3c869eb9e15f10da6eb92303b96dfb5 (diff) | |
| download | rust-7ea507e0415deedf8ba7d477ef0fba4da9c90ae2.tar.gz rust-7ea507e0415deedf8ba7d477ef0fba4da9c90ae2.zip | |
Rollup merge of #125451 - oli-obk:const_type_mismatch, r=compiler-errors
Fail relating constants of different types fixes #121585 fixes #121858 fixes #124151 I gave this several attempts before, but we lost too many important diagnostics until I managed to make compilation never bail out early. We have reached this point, so now we can finally fix all those ICEs by bubbling up an error instead of continueing when we encounter a bug.
Diffstat (limited to 'tests/ui/const-generics/generic_const_exprs')
| -rw-r--r-- | tests/ui/const-generics/generic_const_exprs/type_mismatch.rs | 2 | ||||
| -rw-r--r-- | tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr | 14 |
2 files changed, 5 insertions, 11 deletions
diff --git a/tests/ui/const-generics/generic_const_exprs/type_mismatch.rs b/tests/ui/const-generics/generic_const_exprs/type_mismatch.rs index 6b0d9e047db..285f9dee6c2 100644 --- a/tests/ui/const-generics/generic_const_exprs/type_mismatch.rs +++ b/tests/ui/const-generics/generic_const_exprs/type_mismatch.rs @@ -10,7 +10,7 @@ impl<const N: u64> Q for [u8; N] {} //~| ERROR mismatched types pub fn q_user() -> [u8; <[u8; 13] as Q>::ASSOC] {} -//~^ ERROR the constant `13` is not of type `u64` +//~^ ERROR `[u8; 13]: Q` is not satisfied //~| ERROR mismatched types pub fn main() {} diff --git a/tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr b/tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr index bb6d650b7ab..a63a56dd675 100644 --- a/tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr +++ b/tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr @@ -7,19 +7,13 @@ LL | const ASSOC: usize; LL | impl<const N: u64> Q for [u8; N] {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `ASSOC` in implementation -error: the constant `13` is not of type `u64` +error[E0277]: the trait bound `[u8; 13]: Q` is not satisfied --> $DIR/type_mismatch.rs:12:26 | LL | pub fn q_user() -> [u8; <[u8; 13] as Q>::ASSOC] {} - | ^^^^^^^^ expected `u64`, found `usize` + | ^^^^^^^^ the trait `Q` is not implemented for `[u8; 13]` | -note: required for `[u8; 13]` to implement `Q` - --> $DIR/type_mismatch.rs:8:20 - | -LL | impl<const N: u64> Q for [u8; N] {} - | ------------ ^ ^^^^^^^ - | | - | unsatisfied trait bound introduced here + = help: the trait `Q` is implemented for `[u8; N]` error[E0308]: mismatched types --> $DIR/type_mismatch.rs:12:20 @@ -37,5 +31,5 @@ LL | impl<const N: u64> Q for [u8; N] {} error: aborting due to 4 previous errors -Some errors have detailed explanations: E0046, E0308. +Some errors have detailed explanations: E0046, E0277, E0308. For more information about an error, try `rustc --explain E0046`. |
