-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ICE from trying to convert constant error to usize
- Loading branch information
Showing
3 changed files
with
66 additions
and
1 deletion.
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
30 changes: 30 additions & 0 deletions
30
tests/ui/const-generics/generic_const_exprs/match-with-error-length.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,30 @@ | ||
// edition:2018 | ||
// https://github.com/rust-lang/rust/issues/113021 | ||
|
||
#![feature(generic_const_exprs)] | ||
#![allow(incomplete_features)] | ||
|
||
pub async fn a(path: &[(); Abc]) { | ||
//~^ ERROR cannot find value `Abc` in this scope | ||
match path { | ||
[] | _ => (), | ||
} | ||
} | ||
|
||
pub async fn b(path: &[(); Abc]) { | ||
//~^ ERROR cannot find value `Abc` in this scope | ||
match path { | ||
&[] | _ => (), | ||
} | ||
} | ||
|
||
pub async fn c(path: &[[usize; N_ISLANDS]; PrivateStruct]) -> usize { | ||
//~^ ERROR cannot find value `N_ISLANDS` in this scope | ||
//~| ERROR cannot find value `PrivateStruct` in this scope | ||
match path { | ||
[] | _ => 0, | ||
} | ||
} | ||
|
||
|
||
fn main() {} |
27 changes: 27 additions & 0 deletions
27
tests/ui/const-generics/generic_const_exprs/match-with-error-length.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,27 @@ | ||
error[E0425]: cannot find value `Abc` in this scope | ||
--> $DIR/match-with-error-length.rs:7:28 | ||
| | ||
LL | pub async fn a(path: &[(); Abc]) { | ||
| ^^^ not found in this scope | ||
|
||
error[E0425]: cannot find value `Abc` in this scope | ||
--> $DIR/match-with-error-length.rs:14:28 | ||
| | ||
LL | pub async fn b(path: &[(); Abc]) { | ||
| ^^^ not found in this scope | ||
|
||
error[E0425]: cannot find value `N_ISLANDS` in this scope | ||
--> $DIR/match-with-error-length.rs:21:32 | ||
| | ||
LL | pub async fn c(path: &[[usize; N_ISLANDS]; PrivateStruct]) -> usize { | ||
| ^^^^^^^^^ not found in this scope | ||
|
||
error[E0425]: cannot find value `PrivateStruct` in this scope | ||
--> $DIR/match-with-error-length.rs:21:44 | ||
| | ||
LL | pub async fn c(path: &[[usize; N_ISLANDS]; PrivateStruct]) -> usize { | ||
| ^^^^^^^^^^^^^ not found in this scope | ||
|
||
error: aborting due to 4 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0425`. |