From a42adf2f9549eedb715b027e3ba7794bddab127e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sun, 21 Apr 2024 21:43:47 +0200 Subject: [PATCH] add test for ICE caused by using feature(generic_const_exprs) #114463 Fixes #114463 --- .../cannot-convert-refree-ice-114463.rs | 10 ++++++++++ .../cannot-convert-refree-ice-114463.stderr | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 tests/ui/const-generics/generic_const_exprs/cannot-convert-refree-ice-114463.rs create mode 100644 tests/ui/const-generics/generic_const_exprs/cannot-convert-refree-ice-114463.stderr diff --git a/tests/ui/const-generics/generic_const_exprs/cannot-convert-refree-ice-114463.rs b/tests/ui/const-generics/generic_const_exprs/cannot-convert-refree-ice-114463.rs new file mode 100644 index 00000000000..2ce998e9fd9 --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/cannot-convert-refree-ice-114463.rs @@ -0,0 +1,10 @@ +// issue: rust-lang/rust#114463 +// ICE cannot convert `ReFree ..` to a region vid +#![feature(generic_const_exprs)] +//~^ WARN the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes +fn bug<'a>() { + [(); (|_: &'a u8| (), 0).1]; + //~^ ERROR cannot capture late-bound lifetime in constant +} + +pub fn main() {} diff --git a/tests/ui/const-generics/generic_const_exprs/cannot-convert-refree-ice-114463.stderr b/tests/ui/const-generics/generic_const_exprs/cannot-convert-refree-ice-114463.stderr new file mode 100644 index 00000000000..e4845405ec8 --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/cannot-convert-refree-ice-114463.stderr @@ -0,0 +1,19 @@ +warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/cannot-convert-refree-ice-114463.rs:3:12 + | +LL | #![feature(generic_const_exprs)] + | ^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #76560 for more information + = note: `#[warn(incomplete_features)]` on by default + +error: cannot capture late-bound lifetime in constant + --> $DIR/cannot-convert-refree-ice-114463.rs:6:16 + | +LL | fn bug<'a>() { + | -- lifetime defined here +LL | [(); (|_: &'a u8| (), 0).1]; + | ^^ + +error: aborting due to 1 previous error; 1 warning emitted +