-
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.
Use param's real type in try_eval_lit_or_param
- Loading branch information
1 parent
39f2657
commit 9574f39
Showing
10 changed files
with
59 additions
and
27 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
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,23 +1,35 @@ | ||
error: the constant `N` is not of type `u8` | ||
--> $DIR/type_mismatch.rs:2:5 | ||
| | ||
LL | bar::<N>() | ||
| ^^^^^^^^ | ||
| | ||
note: required by a bound in `bar` | ||
--> $DIR/type_mismatch.rs:6:8 | ||
| | ||
LL | fn bar<const N: u8>() -> [u8; N] {} | ||
| ^^^^^^^^^^^ required by this bound in `bar` | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/type_mismatch.rs:2:11 | ||
| | ||
LL | bar::<N>() | ||
| ^ expected `u8`, found `usize` | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/type_mismatch.rs:5:26 | ||
--> $DIR/type_mismatch.rs:6:26 | ||
| | ||
LL | fn bar<const N: u8>() -> [u8; N] {} | ||
| --- ^^^^^^^ expected `[u8; N]`, found `()` | ||
| | | ||
| implicitly returns `()` as its body has no tail or `return` expression | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/type_mismatch.rs:5:31 | ||
--> $DIR/type_mismatch.rs:6:31 | ||
| | ||
LL | fn bar<const N: u8>() -> [u8; N] {} | ||
| ^ expected `usize`, found `u8` | ||
|
||
error: aborting due to 3 previous errors | ||
error: aborting due to 4 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
12 changes: 12 additions & 0 deletions
12
tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.rs
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#![feature(min_specialization)] | ||
|
||
// An impl that has an erroneous const substitution should not specialize one | ||
// that is well-formed. | ||
|
||
struct S<const L: usize>; | ||
|
||
impl<const N: i32> Copy for S<N> {} | ||
impl<const M: usize> Copy for S<M> {} | ||
//~^ ERROR conflicting implementations of trait `Copy` for type `S<_>` | ||
|
||
fn main() {} |
11 changes: 11 additions & 0 deletions
11
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
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> {} | ||
| -------------------------------- first implementation here | ||
LL | impl<const M: usize> Copy for S<M> {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `S<_>` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0119`. |
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