@@ -7,7 +7,7 @@ use std::fmt::Debug;
7
7
// We have a `&'a self`, so we need a `Self: 'a`
8
8
trait Iterable {
9
9
type Item < ' x > ;
10
- //~^ Missing required bounds
10
+ //~^ missing required
11
11
fn iter < ' a > ( & ' a self ) -> Self :: Item < ' a > ;
12
12
}
13
13
@@ -23,7 +23,7 @@ impl<T> Iterable for T {
23
23
// We have a `&'a T`, so we need a `T: 'x`
24
24
trait Deserializer < T > {
25
25
type Out < ' x > ;
26
- //~^ Missing required bounds
26
+ //~^ missing required
27
27
fn deserialize < ' a > ( & self , input : & ' a T ) -> Self :: Out < ' a > ;
28
28
}
29
29
@@ -37,14 +37,14 @@ impl<T> Deserializer<T> for () {
37
37
// We have a `&'b T` and a `'b: 'a`, so it is implied that `T: 'a`. Therefore, we need a `T: 'x`
38
38
trait Deserializer2 < T > {
39
39
type Out < ' x > ;
40
- //~^ Missing required bounds
40
+ //~^ missing required
41
41
fn deserialize2 < ' a , ' b : ' a > ( & self , input1 : & ' b T ) -> Self :: Out < ' a > ;
42
42
}
43
43
44
44
// We have a `&'a T` and a `&'b U`, so we need a `T: 'x` and a `U: 'y`
45
45
trait Deserializer3 < T , U > {
46
46
type Out < ' x , ' y > ;
47
- //~^ Missing required bounds
47
+ //~^ missing required
48
48
fn deserialize2 < ' a , ' b > ( & self , input : & ' a T , input2 : & ' b U ) -> Self :: Out < ' a , ' b > ;
49
49
}
50
50
@@ -59,7 +59,7 @@ struct Wrap<T>(T);
59
59
// We pass `Wrap<T>` and we see `&'z Wrap<T>`, so we require `D: 'x`
60
60
trait Des {
61
61
type Out < ' x , D > ;
62
- //~^ Missing required bounds
62
+ //~^ missing required
63
63
fn des < ' z , T > ( & self , data : & ' z Wrap < T > ) -> Self :: Out < ' z , Wrap < T > > ;
64
64
}
65
65
/*
@@ -75,7 +75,7 @@ impl Des for () {
75
75
// implied bound that `T: 'z`, so we require `D: 'x`
76
76
trait Des2 {
77
77
type Out < ' x , D > ;
78
- //~^ Missing required bounds
78
+ //~^ missing required
79
79
fn des < ' z , T > ( & self , data : & ' z Wrap < T > ) -> Self :: Out < ' z , T > ;
80
80
}
81
81
/*
@@ -90,7 +90,7 @@ impl Des2 for () {
90
90
// We see `&'z T`, so we require `D: 'x`
91
91
trait Des3 {
92
92
type Out < ' x , D > ;
93
- //~^ Missing required bounds
93
+ //~^ missing required
94
94
fn des < ' z , T > ( & self , data : & ' z T ) -> Self :: Out < ' z , T > ;
95
95
}
96
96
/*
@@ -112,22 +112,22 @@ trait NoGat<'a> {
112
112
// FIXME: we require two bounds (`where Self: 'a, Self: 'b`) when we should only require one
113
113
trait TraitLifetime < ' a > {
114
114
type Bar < ' b > ;
115
- //~^ Missing required bounds
115
+ //~^ missing required
116
116
fn method ( & ' a self ) -> Self :: Bar < ' a > ;
117
117
}
118
118
119
119
// Like above, but we have a where clause that can prove what we want
120
120
// FIXME: we require two bounds (`where Self: 'a, Self: 'b`) when we should only require one
121
121
trait TraitLifetimeWhere < ' a > where Self : ' a {
122
122
type Bar < ' b > ;
123
- //~^ Missing required bounds
123
+ //~^ missing required
124
124
fn method ( & ' a self ) -> Self :: Bar < ' a > ;
125
125
}
126
126
127
127
// Explicit bound instead of implicit; we want to still error
128
128
trait ExplicitBound {
129
129
type Bar < ' b > ;
130
- //~^ Missing required bounds
130
+ //~^ missing required
131
131
fn method < ' b > ( & self , token : & ' b ( ) ) -> Self :: Bar < ' b > where Self : ' b ;
132
132
}
133
133
@@ -141,14 +141,15 @@ trait NotInReturn {
141
141
trait IterableTwo {
142
142
type Item < ' a > ;
143
143
type Iterator < ' a > : Iterator < Item = Self :: Item < ' a > > ;
144
- //~^ Missing required bounds
144
+ //~^ missing required
145
145
fn iter < ' a > ( & ' a self ) -> Self :: Iterator < ' a > ;
146
146
}
147
147
148
- // We also should report region outlives clauses
148
+ // We also should report region outlives clauses. Here, we know that `'y: 'x`,
149
+ // because of `&'x &'y`, so we require that `'b: 'a`.
149
150
trait RegionOutlives {
150
151
type Bar < ' a , ' b > ;
151
- //~^ Missing required bounds
152
+ //~^ missing required
152
153
fn foo < ' x , ' y > ( & self , input : & ' x & ' y ( ) ) -> Self :: Bar < ' x , ' y > ;
153
154
}
154
155
@@ -161,6 +162,17 @@ impl Foo for () {
161
162
}
162
163
*/
163
164
165
+ // Similar to the above, except with explicit bounds
166
+ trait ExplicitRegionOutlives < ' ctx > {
167
+ type Fut < ' out > ;
168
+ //~^ missing required
169
+
170
+ fn test < ' out > ( ctx : & ' ctx i32 ) -> Self :: Fut < ' out >
171
+ where
172
+ ' ctx : ' out ;
173
+ }
174
+
175
+
164
176
// If there are multiple methods that return the GAT, require a set of clauses
165
177
// that can be satisfied by *all* methods
166
178
trait MultipleMethods {
@@ -170,4 +182,11 @@ trait MultipleMethods {
170
182
fn gimme_default ( & self ) -> Self :: Bar < ' static > ;
171
183
}
172
184
185
+ // We would normally require `Self: 'a`, but we can prove that `Self: 'static`
186
+ // because of the the bounds on the trait, so the bound is proven
187
+ trait Trait : ' static {
188
+ type Assoc < ' a > ;
189
+ fn make_assoc ( _: & u32 ) -> Self :: Assoc < ' _ > ;
190
+ }
191
+
173
192
fn main ( ) { }
0 commit comments