@@ -54,7 +54,7 @@ use rustc_hir::def_id::{CRATE_DEF_ID, LOCAL_CRATE, LocalDefId};
5454use rustc_hir:: lints:: DelayedLint ;
5555use rustc_hir:: {
5656 self as hir, AngleBrackets , ConstArg , GenericArg , HirId , ItemLocalMap , LangItem ,
57- LifetimeSource , LifetimeSyntax , ParamName , TraitCandidate ,
57+ LifetimeSource , LifetimeSyntax , ParamName , TraitCandidate , TySource ,
5858} ;
5959use rustc_index:: { Idx , IndexSlice , IndexVec } ;
6060use rustc_macros:: extension;
@@ -1220,7 +1220,12 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
12201220 bounds,
12211221 TaggedRef :: new ( lifetime_bound, TraitObjectSyntax :: None ) ,
12221222 ) ;
1223- return hir:: Ty { kind, span : self . lower_span ( t. span ) , hir_id : self . next_id ( ) } ;
1223+ return hir:: Ty {
1224+ kind,
1225+ span : self . lower_span ( t. span ) ,
1226+ hir_id : self . next_id ( ) ,
1227+ source : TySource :: Other ,
1228+ } ;
12241229 }
12251230
12261231 let id = self . lower_node_id ( t. id ) ;
@@ -1237,7 +1242,12 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
12371242 }
12381243
12391244 fn ty ( & mut self , span : Span , kind : hir:: TyKind < ' hir > ) -> hir:: Ty < ' hir > {
1240- hir:: Ty { hir_id : self . next_id ( ) , kind, span : self . lower_span ( span) }
1245+ hir:: Ty {
1246+ hir_id : self . next_id ( ) ,
1247+ kind,
1248+ span : self . lower_span ( span) ,
1249+ source : TySource :: Other ,
1250+ }
12411251 }
12421252
12431253 fn ty_tup ( & mut self , span : Span , tys : & ' hir [ hir:: Ty < ' hir > ] ) -> hir:: Ty < ' hir > {
@@ -1258,7 +1268,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
12581268 let lifetime = self . lower_ty_direct_lifetime ( t, * region) ;
12591269 let kind = hir:: TyKind :: Ref ( lifetime, self . lower_mt ( mt, itctx) ) ;
12601270 let span = self . lower_span ( t. span ) ;
1261- let arg = hir:: Ty { kind, span, hir_id : self . next_id ( ) } ;
1271+ let arg = hir:: Ty { kind, span, hir_id : self . next_id ( ) , source : TySource :: Other } ;
12621272 let args = self . arena . alloc ( hir:: GenericArgs {
12631273 args : self . arena . alloc ( [ hir:: GenericArg :: Type ( self . arena . alloc ( arg) ) ] ) ,
12641274 constraints : & [ ] ,
@@ -1423,7 +1433,12 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
14231433 TyKind :: Dummy => panic ! ( "`TyKind::Dummy` should never be lowered" ) ,
14241434 } ;
14251435
1426- hir:: Ty { kind, span : self . lower_span ( t. span ) , hir_id : self . lower_node_id ( t. id ) }
1436+ hir:: Ty {
1437+ kind,
1438+ span : self . lower_span ( t. span ) ,
1439+ hir_id : self . lower_node_id ( t. id ) ,
1440+ source : TySource :: Other ,
1441+ }
14271442 }
14281443
14291444 fn lower_ty_direct_lifetime (
@@ -2421,7 +2436,17 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
24212436 }
24222437 }
24232438
2424- fn ty_path ( & mut self , mut hir_id : HirId , span : Span , qpath : hir:: QPath < ' hir > ) -> hir:: Ty < ' hir > {
2439+ fn ty_path ( & mut self , hir_id : HirId , span : Span , qpath : hir:: QPath < ' hir > ) -> hir:: Ty < ' hir > {
2440+ self . ty_path_with_source ( hir_id, span, qpath, TySource :: Other )
2441+ }
2442+
2443+ fn ty_path_with_source (
2444+ & mut self ,
2445+ mut hir_id : HirId ,
2446+ span : Span ,
2447+ qpath : hir:: QPath < ' hir > ,
2448+ source : TySource ,
2449+ ) -> hir:: Ty < ' hir > {
24252450 let kind = match qpath {
24262451 hir:: QPath :: Resolved ( None , path) => {
24272452 // Turn trait object paths into `TyKind::TraitObject` instead.
@@ -2448,7 +2473,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
24482473 _ => hir:: TyKind :: Path ( qpath) ,
24492474 } ;
24502475
2451- hir:: Ty { hir_id, kind, span : self . lower_span ( span) }
2476+ hir:: Ty { hir_id, kind, span : self . lower_span ( span) , source }
24522477 }
24532478
24542479 /// Invoked to create the lifetime argument(s) for an elided trait object
0 commit comments