@@ -253,11 +253,24 @@ pub struct ConstArg {
253253 pub span : Span ,
254254}
255255
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+
256268#[ derive( Debug , HashStable_Generic ) ]
257269pub enum GenericArg < ' hir > {
258270 Lifetime ( Lifetime ) ,
259271 Type ( Ty < ' hir > ) ,
260272 Const ( ConstArg ) ,
273+ Infer ( InferArg ) ,
261274}
262275
263276impl GenericArg < ' _ > {
@@ -266,6 +279,7 @@ impl GenericArg<'_> {
266279 GenericArg :: Lifetime ( l) => l. span ,
267280 GenericArg :: Type ( t) => t. span ,
268281 GenericArg :: Const ( c) => c. span ,
282+ GenericArg :: Infer ( i) => i. span ,
269283 }
270284 }
271285
@@ -274,6 +288,7 @@ impl GenericArg<'_> {
274288 GenericArg :: Lifetime ( l) => l. hir_id ,
275289 GenericArg :: Type ( t) => t. hir_id ,
276290 GenericArg :: Const ( c) => c. value . hir_id ,
291+ GenericArg :: Infer ( i) => i. hir_id ,
277292 }
278293 }
279294
@@ -290,6 +305,7 @@ impl GenericArg<'_> {
290305 GenericArg :: Lifetime ( _) => "lifetime" ,
291306 GenericArg :: Type ( _) => "type" ,
292307 GenericArg :: Const ( _) => "constant" ,
308+ GenericArg :: Infer ( _) => "inferred" ,
293309 }
294310 }
295311
@@ -300,6 +316,7 @@ impl GenericArg<'_> {
300316 GenericArg :: Const ( _) => {
301317 ast:: ParamKindOrd :: Const { unordered : feats. unordered_const_ty_params ( ) }
302318 }
319+ GenericArg :: Infer ( _) => ast:: ParamKindOrd :: Infer ,
303320 }
304321 }
305322}
@@ -341,6 +358,7 @@ impl GenericArgs<'_> {
341358 break ;
342359 }
343360 GenericArg :: Const ( _) => { }
361+ GenericArg :: Infer ( _) => { }
344362 }
345363 }
346364 }
@@ -358,6 +376,7 @@ impl GenericArgs<'_> {
358376 GenericArg :: Lifetime ( _) => own_counts. lifetimes += 1 ,
359377 GenericArg :: Type ( _) => own_counts. types += 1 ,
360378 GenericArg :: Const ( _) => own_counts. consts += 1 ,
379+ GenericArg :: Infer ( _) => own_counts. infer += 1 ,
361380 } ;
362381 }
363382
@@ -484,6 +503,7 @@ pub struct GenericParamCount {
484503 pub lifetimes : usize ,
485504 pub types : usize ,
486505 pub consts : usize ,
506+ pub infer : usize ,
487507}
488508
489509/// Represents lifetimes and type parameters attached to a declaration
@@ -2987,6 +3007,8 @@ pub enum Node<'hir> {
29873007 Visibility ( & ' hir Visibility < ' hir > ) ,
29883008
29893009 Crate ( & ' hir Mod < ' hir > ) ,
3010+
3011+ Infer ( & ' hir InferArg ) ,
29903012}
29913013
29923014impl < ' hir > Node < ' hir > {
@@ -3055,6 +3077,7 @@ impl<'hir> Node<'hir> {
30553077 | Node :: Local ( Local { hir_id, .. } )
30563078 | Node :: Lifetime ( Lifetime { hir_id, .. } )
30573079 | Node :: Param ( Param { hir_id, .. } )
3080+ | Node :: Infer ( InferArg { hir_id, .. } )
30583081 | Node :: GenericParam ( GenericParam { hir_id, .. } ) => Some ( * hir_id) ,
30593082 Node :: TraitRef ( TraitRef { hir_ref_id, .. } ) => Some ( * hir_ref_id) ,
30603083 Node :: PathSegment ( PathSegment { hir_id, .. } ) => * hir_id,
0 commit comments