User type annotations for free consts in pattern position

This commit is contained in:
Boxy 2025-05-01 13:11:53 +01:00
parent 6e23095adf
commit bfe3d54d81
3 changed files with 26 additions and 2 deletions

View file

@ -0,0 +1,14 @@
#![feature(generic_const_items)]
#![expect(incomplete_features)]
const FOO<'a: 'static>: usize = 10;
fn bar<'a>() {
match 10_usize {
FOO::<'a> => todo!(),
//~^ ERROR: lifetime may not live long enough
_ => todo!(),
}
}
fn main() {}

View file

@ -0,0 +1,11 @@
error: lifetime may not live long enough
--> $DIR/user_type_annotations_pattern.rs:8:9
|
LL | fn bar<'a>() {
| -- lifetime `'a` defined here
LL | match 10_usize {
LL | FOO::<'a> => todo!(),
| ^^^^^^^^^ requires that `'a` must outlive `'static`
error: aborting due to 1 previous error