forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#120059 - oli-obk:const_arg_type_mismatch, r…
…=compiler-errors Make generic const type mismatches not hide trait impls from the trait solver pulled out of rust-lang#119895 It does improve diagnostics somewhat, but also causes some extraneous diagnostics in potentially misleading order. The issue was that a const type mismatch, instead of reporting an error, would silently poison the constant, only for that information to be thrown away and the impl to be treated as "not matching". In rust-lang#119895 this would cause ICEs as well as errors on impls stating that the impl needs to exist for itself to be valid.
- Loading branch information
Showing
7 changed files
with
67 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,23 @@ | ||
error: the constant `13` is not of type `u64` | ||
--> $DIR/bad-subst-const-kind.rs:13:24 | ||
| | ||
LL | pub fn test() -> [u8; <[u8; 13] as Q>::ASSOC] { todo!() } | ||
| ^^^^^^^^ expected `u64`, found `usize` | ||
| | ||
note: required for `[u8; 13]` to implement `Q` | ||
--> $DIR/bad-subst-const-kind.rs:8:20 | ||
| | ||
LL | impl<const N: u64> Q for [u8; N] { | ||
| ------------ ^ ^^^^^^^ | ||
| | | ||
| unsatisfied trait bound introduced here | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/bad-subst-const-kind.rs:8:31 | ||
| | ||
LL | impl<const N: u64> Q for [u8; N] { | ||
| ^ expected `usize`, found `u64` | ||
|
||
error: aborting due to 1 previous error | ||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0308`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 6 additions & 9 deletions
15
tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
error: the constant `N` is not of type `usize` | ||
--> $DIR/bad-const-wf-doesnt-specialize.rs:8:29 | ||
error[E0119]: conflicting implementations of trait `Copy` for type `S<_>` | ||
--> $DIR/bad-const-wf-doesnt-specialize.rs:9:1 | ||
| | ||
LL | impl<const N: i32> Copy for S<N> {} | ||
| ^^^^ expected `usize`, found `i32` | ||
| | ||
note: required by a bound in `S` | ||
--> $DIR/bad-const-wf-doesnt-specialize.rs:6:10 | ||
| | ||
LL | struct S<const L: usize>; | ||
| ^^^^^^^^^^^^^^ required by this bound in `S` | ||
| -------------------------------- first implementation here | ||
LL | impl<const M: usize> Copy for S<M> {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `S<_>` | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0119`. |