-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Always take the
Ok
path in lit_to_const
and produce error constan…
…ts instead
- Loading branch information
Showing
9 changed files
with
103 additions
and
83 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
tests/ui/const-generics/generic_const_exprs/lit_type_mismatch.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,22 @@ | ||
//! ICE regression test for #114317 and #126182 | ||
//! Type mismatches of literals cause errors int typeck, | ||
//! but those errors cannot be propagated to the various | ||
//! `lit_to_const` call sites. Now `lit_to_const` just delays | ||
//! a bug and produces an error constant on its own. | ||
#![feature(adt_const_params)] | ||
#![feature(generic_const_exprs)] | ||
#![allow(incomplete_features)] | ||
|
||
struct A<const B: () = 1, C>(C); | ||
//~^ ERROR: generic parameters with a default must be trailing | ||
//~| ERROR: mismatched types | ||
|
||
struct Cond<const B: bool>; | ||
|
||
struct Thing<T = Cond<0>>(T); | ||
//~^ ERROR: mismatched types | ||
|
||
impl Thing {} | ||
|
||
fn main() {} |
21 changes: 21 additions & 0 deletions
21
tests/ui/const-generics/generic_const_exprs/lit_type_mismatch.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,21 @@ | ||
error: generic parameters with a default must be trailing | ||
--> $DIR/lit_type_mismatch.rs:11:16 | ||
| | ||
LL | struct A<const B: () = 1, C>(C); | ||
| ^ | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/lit_type_mismatch.rs:11:24 | ||
| | ||
LL | struct A<const B: () = 1, C>(C); | ||
| ^ expected `()`, found integer | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/lit_type_mismatch.rs:17:23 | ||
| | ||
LL | struct Thing<T = Cond<0>>(T); | ||
| ^ expected `bool`, found integer | ||
|
||
error: aborting due to 3 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