-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make generic const type mismatches not hide trait impls from the trai…
…t solver
- Loading branch information
Showing
7 changed files
with
80 additions
and
31 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
23 changes: 19 additions & 4 deletions
23
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,29 @@ | ||
error[E0119]: conflicting implementations of trait `Copy` for type `S<_>` | ||
--> $DIR/bad-const-wf-doesnt-specialize.rs:10:1 | ||
| | ||
LL | impl<const N: i32> Copy for S<N> {} | ||
| -------------------------------- first implementation here | ||
LL | | ||
LL | impl<const M: usize> Copy for S<M> {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `S<_>` | ||
|
||
error: the constant `N` is not of type `usize` | ||
--> $DIR/bad-const-wf-doesnt-specialize.rs:8:29 | ||
| | ||
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 | ||
note: required for `S<N>` to implement `Clone` | ||
--> $DIR/bad-const-wf-doesnt-specialize.rs:5:10 | ||
| | ||
LL | #[derive(Clone)] | ||
| ^^^^^ | ||
LL | struct S<const L: usize>; | ||
| ^^^^^^^^^^^^^^ required by this bound in `S` | ||
| ----- unsatisfied trait bound introduced in this `derive` macro | ||
note: required by a bound in `Copy` | ||
--> $SRC_DIR/core/src/marker.rs:LL:COL | ||
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: aborting due to 1 previous error | ||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0119`. |