rust/tests/ui/impl-trait/defining-use-captured-non-universal-region.rs
2024-03-28 06:00:26 +00:00

25 lines
619 B
Rust

// This was an ICE. See #110726.
// FIXME(aliemjay): outdated due to "once modulo regions" restriction.
//@ revisions: statik infer fixed
//@ [fixed] check-pass
#![allow(unconditional_recursion)]
fn foo<'a>() -> impl Sized + 'a {
#[cfg(statik)]
let i: i32 = foo::<'static>();
//[statik]~^ ERROR opaque type used twice with different lifetimes
//[statik]~| ERROR opaque type used twice with different lifetimes
#[cfg(infer)]
let i: i32 = foo::<'_>();
//[infer]~^ ERROR expected generic lifetime parameter, found `'_`
#[cfg(fixed)]
let i: i32 = foo::<'a>();
i
}
fn main() {}