@@ -253,11 +253,24 @@ pub struct ConstArg {
253
253
pub span : Span ,
254
254
}
255
255
256
+ #[ derive( Encodable , Debug , HashStable_Generic ) ]
257
+ pub struct InferArg {
258
+ pub hir_id : HirId ,
259
+ pub span : Span ,
260
+ }
261
+
262
+ impl InferArg {
263
+ pub fn to_ty ( & self ) -> Ty < ' _ > {
264
+ Ty { kind : TyKind :: Infer , span : self . span , hir_id : self . hir_id }
265
+ }
266
+ }
267
+
256
268
#[ derive( Debug , HashStable_Generic ) ]
257
269
pub enum GenericArg < ' hir > {
258
270
Lifetime ( Lifetime ) ,
259
271
Type ( Ty < ' hir > ) ,
260
272
Const ( ConstArg ) ,
273
+ Infer ( InferArg ) ,
261
274
}
262
275
263
276
impl GenericArg < ' _ > {
@@ -266,6 +279,7 @@ impl GenericArg<'_> {
266
279
GenericArg :: Lifetime ( l) => l. span ,
267
280
GenericArg :: Type ( t) => t. span ,
268
281
GenericArg :: Const ( c) => c. span ,
282
+ GenericArg :: Infer ( i) => i. span ,
269
283
}
270
284
}
271
285
@@ -274,6 +288,7 @@ impl GenericArg<'_> {
274
288
GenericArg :: Lifetime ( l) => l. hir_id ,
275
289
GenericArg :: Type ( t) => t. hir_id ,
276
290
GenericArg :: Const ( c) => c. value . hir_id ,
291
+ GenericArg :: Infer ( i) => i. hir_id ,
277
292
}
278
293
}
279
294
@@ -290,6 +305,7 @@ impl GenericArg<'_> {
290
305
GenericArg :: Lifetime ( _) => "lifetime" ,
291
306
GenericArg :: Type ( _) => "type" ,
292
307
GenericArg :: Const ( _) => "constant" ,
308
+ GenericArg :: Infer ( _) => "inferred" ,
293
309
}
294
310
}
295
311
@@ -300,6 +316,7 @@ impl GenericArg<'_> {
300
316
GenericArg :: Const ( _) => {
301
317
ast:: ParamKindOrd :: Const { unordered : feats. unordered_const_ty_params ( ) }
302
318
}
319
+ GenericArg :: Infer ( _) => ast:: ParamKindOrd :: Infer ,
303
320
}
304
321
}
305
322
}
@@ -341,6 +358,7 @@ impl GenericArgs<'_> {
341
358
break ;
342
359
}
343
360
GenericArg :: Const ( _) => { }
361
+ GenericArg :: Infer ( _) => { }
344
362
}
345
363
}
346
364
}
@@ -358,6 +376,7 @@ impl GenericArgs<'_> {
358
376
GenericArg :: Lifetime ( _) => own_counts. lifetimes += 1 ,
359
377
GenericArg :: Type ( _) => own_counts. types += 1 ,
360
378
GenericArg :: Const ( _) => own_counts. consts += 1 ,
379
+ GenericArg :: Infer ( _) => own_counts. infer += 1 ,
361
380
} ;
362
381
}
363
382
@@ -484,6 +503,7 @@ pub struct GenericParamCount {
484
503
pub lifetimes : usize ,
485
504
pub types : usize ,
486
505
pub consts : usize ,
506
+ pub infer : usize ,
487
507
}
488
508
489
509
/// Represents lifetimes and type parameters attached to a declaration
@@ -2987,6 +3007,8 @@ pub enum Node<'hir> {
2987
3007
Visibility ( & ' hir Visibility < ' hir > ) ,
2988
3008
2989
3009
Crate ( & ' hir Mod < ' hir > ) ,
3010
+
3011
+ Infer ( & ' hir InferArg ) ,
2990
3012
}
2991
3013
2992
3014
impl < ' hir > Node < ' hir > {
@@ -3055,6 +3077,7 @@ impl<'hir> Node<'hir> {
3055
3077
| Node :: Local ( Local { hir_id, .. } )
3056
3078
| Node :: Lifetime ( Lifetime { hir_id, .. } )
3057
3079
| Node :: Param ( Param { hir_id, .. } )
3080
+ | Node :: Infer ( InferArg { hir_id, .. } )
3058
3081
| Node :: GenericParam ( GenericParam { hir_id, .. } ) => Some ( * hir_id) ,
3059
3082
Node :: TraitRef ( TraitRef { hir_ref_id, .. } ) => Some ( * hir_ref_id) ,
3060
3083
Node :: PathSegment ( PathSegment { hir_id, .. } ) => * hir_id,
0 commit comments