Rollup merge of #148554 - chenyukang:test-issue-148542, r=jieyouxu
Add regression test for issue 148542 Closes rust-lang/rust#148542
This commit is contained in:
commit
a3409fde47
2 changed files with 27 additions and 0 deletions
13
tests/ui/pattern/const-error-ice-issue-148542.rs
Normal file
13
tests/ui/pattern/const-error-ice-issue-148542.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
//@ edition: 2021
|
||||
|
||||
// Regression test for #148542
|
||||
// Ensure we don't ICE with "Invalid `ConstKind` for `const_to_pat`: {const error}"
|
||||
|
||||
fn foo() where &str:, {
|
||||
//~^ ERROR `&` without an explicit lifetime name cannot be used here
|
||||
match 42_u8 {
|
||||
-10.. => {}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
14
tests/ui/pattern/const-error-ice-issue-148542.stderr
Normal file
14
tests/ui/pattern/const-error-ice-issue-148542.stderr
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
error[E0637]: `&` without an explicit lifetime name cannot be used here
|
||||
--> $DIR/const-error-ice-issue-148542.rs:6:16
|
||||
|
|
||||
LL | fn foo() where &str:, {
|
||||
| ^ explicit lifetime name needed here
|
||||
|
|
||||
help: consider introducing a higher-ranked lifetime here
|
||||
|
|
||||
LL | fn foo() where for<'a> &'a str:, {
|
||||
| +++++++ ++
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0637`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue