File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change 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
1414fn foo ( x : & ' x u8 ) -> & ' x u8 { x }
1515fn foo2 ( x : & ' a u8 , y : & u8 ) -> & ' a u8 { x }
@@ -81,4 +81,24 @@ fn in_generics_in_band<T: MyTrait<'a>>(x: &T) {}
8181fn where_clause_in_band < T > ( x : & T ) where T : MyTrait < ' a > { }
8282fn 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+
84104fn main ( ) { }
You can’t perform that action at this time.
0 commit comments