rust/tests/ui/impl-trait/in-trait/variance.rs

26 lines
816 B
Rust
Raw Normal View History

2024-09-29 17:41:13 +00:00
#![feature(rustc_attrs, precise_capturing_in_traits)]
2023-08-08 19:59:44 +00:00
#![allow(internal_features)]
#![rustc_variance_of_opaques]
trait Foo<'i> {
fn implicit_capture_early<'a: 'a>() -> impl Sized {}
//~^ [Self: o, 'i: o, 'a: *, 'i: o, 'a: o]
2024-09-29 17:41:13 +00:00
fn explicit_capture_early<'a: 'a>() -> impl Sized + use<'i, 'a, Self> {}
//~^ [Self: o, 'i: o, 'a: *, 'i: o, 'a: o]
2023-08-08 19:59:44 +00:00
2024-09-29 17:41:13 +00:00
fn not_captured_early<'a: 'a>() -> impl Sized + use<'i, Self> {}
//~^ [Self: o, 'i: o, 'a: *, 'i: o]
2023-08-08 19:59:44 +00:00
fn implicit_capture_late<'a>(_: &'a ()) -> impl Sized {}
//~^ [Self: o, 'i: o, 'i: o, 'a: o]
2024-09-29 17:41:13 +00:00
fn explicit_capture_late<'a>(_: &'a ()) -> impl Sized + use<'i, 'a, Self> {}
//~^ [Self: o, 'i: o, 'i: o, 'a: o]
2023-08-08 19:59:44 +00:00
fn not_captured_late<'a>(_: &'a ()) -> impl Sized + use<'i, Self> {}
2024-09-29 17:41:13 +00:00
//~^ [Self: o, 'i: o, 'i: o]
2023-08-08 19:59:44 +00:00
}
fn main() {}