Rollup merge of #97457 - JohnTitor:issue-81899, r=compiler-errors
Add regression test for #81899 Closes #81899 r? `@compiler-errors`
This commit is contained in:
commit
29ac9b13d4
2 changed files with 30 additions and 0 deletions
13
src/test/ui/borrowck/issue-81899.rs
Normal file
13
src/test/ui/borrowck/issue-81899.rs
Normal file
|
@ -0,0 +1,13 @@
|
|||
// Regression test for #81899.
|
||||
// The `panic!()` below is important to trigger the fixed ICE.
|
||||
|
||||
const _CONST: &[u8] = &f(&[], |_| {});
|
||||
|
||||
const fn f<F>(_: &[u8], _: F) -> &[u8]
|
||||
where
|
||||
F: FnMut(&u8),
|
||||
{
|
||||
panic!() //~ ERROR: evaluation of constant value failed
|
||||
}
|
||||
|
||||
fn main() {}
|
17
src/test/ui/borrowck/issue-81899.stderr
Normal file
17
src/test/ui/borrowck/issue-81899.stderr
Normal file
|
@ -0,0 +1,17 @@
|
|||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/issue-81899.rs:10:5
|
||||
|
|
||||
LL | const _CONST: &[u8] = &f(&[], |_| {});
|
||||
| -------------- inside `_CONST` at $DIR/issue-81899.rs:4:24
|
||||
...
|
||||
LL | panic!()
|
||||
| ^^^^^^^^
|
||||
| |
|
||||
| the evaluated program panicked at 'explicit panic', $DIR/issue-81899.rs:10:5
|
||||
| inside `f::<[closure@$DIR/issue-81899.rs:4:31: 4:37]>` at $SRC_DIR/std/src/panic.rs:LL:COL
|
||||
|
|
||||
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0080`.
|
Loading…
Add table
Add a link
Reference in a new issue