@@ -224,22 +224,14 @@ enum LifetimeUseSet {
224
224
225
225
#[ derive( Copy , Clone , Debug ) ]
226
226
enum LifetimeRibKind {
227
- /// This rib acts as a barrier to forbid reference to lifetimes of a parent item.
228
- Item ,
229
-
227
+ // -- Ribs introducing named lifetimes
228
+ //
230
229
/// This rib declares generic parameters.
230
+ /// Only for this kind the `LifetimeRib::bindings` field can be non-empty.
231
231
Generics { binder : NodeId , span : Span , kind : LifetimeBinderKind } ,
232
232
233
- /// FIXME(const_generics): This patches over an ICE caused by non-'static lifetimes in const
234
- /// generics. We are disallowing this until we can decide on how we want to handle non-'static
235
- /// lifetimes in const generics. See issue #74052 for discussion.
236
- ConstGeneric ,
237
-
238
- /// Non-static lifetimes are prohibited in anonymous constants under `min_const_generics`.
239
- /// This function will emit an error if `generic_const_exprs` is not enabled, the body identified by
240
- /// `body_id` is an anonymous constant and `lifetime_ref` is non-static.
241
- AnonConst ,
242
-
233
+ // -- Ribs introducing unnamed lifetimes
234
+ //
243
235
/// Create a new anonymous lifetime parameter and reference it.
244
236
///
245
237
/// If `report_in_path`, report an error when encountering lifetime elision in a path:
@@ -256,16 +248,31 @@ enum LifetimeRibKind {
256
248
/// ```
257
249
AnonymousCreateParameter { binder : NodeId , report_in_path : bool } ,
258
250
251
+ /// Replace all anonymous lifetimes by provided lifetime.
252
+ Elided ( LifetimeRes ) ,
253
+
254
+ // -- Barrier ribs that stop lifetime lookup, or continue it but produce an error later.
255
+ //
259
256
/// Give a hard error when either `&` or `'_` is written. Used to
260
257
/// rule out things like `where T: Foo<'_>`. Does not imply an
261
258
/// error on default object bounds (e.g., `Box<dyn Foo>`).
262
259
AnonymousReportError ,
263
260
264
- /// Replace all anonymous lifetimes by provided lifetime.
265
- Elided ( LifetimeRes ) ,
266
-
267
261
/// Signal we cannot find which should be the anonymous lifetime.
268
262
ElisionFailure ,
263
+
264
+ /// FIXME(const_generics): This patches over an ICE caused by non-'static lifetimes in const
265
+ /// generics. We are disallowing this until we can decide on how we want to handle non-'static
266
+ /// lifetimes in const generics. See issue #74052 for discussion.
267
+ ConstGeneric ,
268
+
269
+ /// Non-static lifetimes are prohibited in anonymous constants under `min_const_generics`.
270
+ /// This function will emit an error if `generic_const_exprs` is not enabled, the body
271
+ /// identified by `body_id` is an anonymous constant and `lifetime_ref` is non-static.
272
+ AnonConst ,
273
+
274
+ /// This rib acts as a barrier to forbid reference to lifetimes of a parent item.
275
+ Item ,
269
276
}
270
277
271
278
#[ derive( Copy , Clone , Debug ) ]
0 commit comments