diff options
| author | Yuki Okushi <jtitor@2k36.org> | 2022-05-28 01:32:15 +0900 |
|---|---|---|
| committer | Yuki Okushi <jtitor@2k36.org> | 2022-05-28 01:32:15 +0900 |
| commit | 6ba9ed86c37d4e8befe50474c619b24891f3c6f2 (patch) | |
| tree | 21b0085eaaffed89deae76b1c1ead7533fb2be5f | |
| parent | 56fd680cf9226ab424f88d4e3b43c5e088d17f19 (diff) | |
| download | rust-6ba9ed86c37d4e8befe50474c619b24891f3c6f2.tar.gz rust-6ba9ed86c37d4e8befe50474c619b24891f3c6f2.zip | |
Add regression test for #81899
| -rw-r--r-- | src/test/ui/borrowck/issue-81899.rs | 13 | ||||
| -rw-r--r-- | src/test/ui/borrowck/issue-81899.stderr | 17 |
2 files changed, 30 insertions, 0 deletions
diff --git a/src/test/ui/borrowck/issue-81899.rs b/src/test/ui/borrowck/issue-81899.rs new file mode 100644 index 00000000000..356517745ff --- /dev/null +++ b/src/test/ui/borrowck/issue-81899.rs @@ -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() {} diff --git a/src/test/ui/borrowck/issue-81899.stderr b/src/test/ui/borrowck/issue-81899.stderr new file mode 100644 index 00000000000..59bf00d0012 --- /dev/null +++ b/src/test/ui/borrowck/issue-81899.stderr @@ -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`. |
