File tree 1 file changed +21
-1
lines changed
1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change 9
9
// except according to those terms.
10
10
11
11
#![ allow( warnings) ]
12
- #![ feature( in_band_lifetimes, universal_impl_trait) ]
12
+ #![ feature( in_band_lifetimes, universal_impl_trait, conservative_impl_trait ) ]
13
13
14
14
fn foo ( x : & ' x u8 ) -> & ' x u8 { x }
15
15
fn foo2 ( x : & ' a u8 , y : & u8 ) -> & ' a u8 { x }
@@ -81,4 +81,24 @@ fn in_generics_in_band<T: MyTrait<'a>>(x: &T) {}
81
81
fn where_clause_in_band < T > ( x : & T ) where T : MyTrait < ' a > { }
82
82
fn impl_trait_in_band ( x : & impl MyTrait < ' a > ) { }
83
83
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
+
84
104
fn main ( ) { }
You can’t perform that action at this time.
0 commit comments