diff options
Diffstat (limited to '')
-rw-r--r-- | tests/ui/impl-trait/variance.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/ui/impl-trait/variance.rs b/tests/ui/impl-trait/variance.rs new file mode 100644 index 000000000..d6212f8f3 --- /dev/null +++ b/tests/ui/impl-trait/variance.rs @@ -0,0 +1,16 @@ +#![feature(rustc_attrs)] +#![allow(internal_features)] +#![rustc_variance_of_opaques] + +trait Captures<'a> {} +impl<T> Captures<'_> for T {} + +fn not_captured_early<'a: 'a>() -> impl Sized {} //~ [*] + +fn captured_early<'a: 'a>() -> impl Sized + Captures<'a> {} //~ [*, o] + +fn not_captured_late<'a>(_: &'a ()) -> impl Sized {} //~ [] + +fn captured_late<'a>(_: &'a ()) -> impl Sized + Captures<'a> {} //~ [o] + +fn main() {} |