Skip to content

Commit 79bf7db

Browse files
committed
add some tests for the interaction with existential impl trait
1 parent d3e0c33 commit 79bf7db

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/test/run-pass/in-band-lifetimes.rs

+21-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
#![allow(warnings)]
12-
#![feature(in_band_lifetimes, universal_impl_trait)]
12+
#![feature(in_band_lifetimes, universal_impl_trait, conservative_impl_trait)]
1313

1414
fn foo(x: &'x u8) -> &'x u8 { x }
1515
fn foo2(x: &'a u8, y: &u8) -> &'a u8 { x }
@@ -81,4 +81,24 @@ fn in_generics_in_band<T: MyTrait<'a>>(x: &T) {}
8181
fn where_clause_in_band<T>(x: &T) where T: MyTrait<'a> {}
8282
fn impl_trait_in_band(x: &impl MyTrait<'a>) {}
8383

84+
// Tests around using in-band lifetimes within existential traits.
85+
86+
trait FunkyTrait<'a> { }
87+
impl<'a, T> FunkyTrait<'a> for T { }
88+
fn existential_impl_trait_in_band_outlives(x: &'a u32) -> impl ::std::fmt::Debug + 'a {
89+
x
90+
}
91+
fn existential_impl_trait_in_band_param(x: &'a u32) -> impl FunkyTrait<'a> {
92+
x
93+
}
94+
fn existential_impl_trait_in_band_param_static(x: &'a u32) -> impl FunkyTrait<'static> + 'a {
95+
x
96+
}
97+
fn existential_impl_trait_in_band_param_outlives(x: &'a u32) -> impl FunkyTrait<'a> + 'a {
98+
x
99+
}
100+
fn existential_impl_trait_in_band_higher_ranked(x: &'a u32) -> impl for<'b> FunkyTrait<'b> + 'a {
101+
x
102+
}
103+
84104
fn main() {}

0 commit comments

Comments
 (0)