rust/tests/ui/impl-trait/defining-use-captured-non-universal-region.rs

23 lines
482 B
Rust
Raw Normal View History

2024-03-18 11:03:18 -05:00
// This was an ICE. See #110726.
//@ revisions: statik infer fixed
//@ [fixed] check-pass
#![allow(unconditional_recursion)]
fn foo<'a>() -> impl Sized + 'a {
#[cfg(statik)]
let i: i32 = foo::<'static>();
2024-03-22 03:02:12 -05:00
//[statik]~^ ERROR expected generic lifetime parameter, found `'static`
2024-03-18 11:03:18 -05:00
#[cfg(infer)]
let i: i32 = foo::<'_>();
//[infer]~^ ERROR expected generic lifetime parameter, found `'_`
#[cfg(fixed)]
let i: i32 = foo::<'a>();
i
}
fn main() {}