@@ -55,7 +55,7 @@ use rustc_hir::def::{DefKind, LifetimeRes, Namespace, PartialRes, PerNS, Res};
5555use rustc_hir:: def_id:: { CRATE_DEF_ID , LOCAL_CRATE , LocalDefId } ;
5656use rustc_hir:: {
5757 self as hir, ConstArg , GenericArg , HirId , ItemLocalMap , LangItem , LifetimeSource ,
58- LifetimeSyntax , ParamName , TraitCandidate ,
58+ LifetimeSyntax , ParamName , TraitCandidate , TySource ,
5959} ;
6060use rustc_index:: { Idx , IndexSlice , IndexVec } ;
6161use rustc_macros:: extension;
@@ -1171,7 +1171,12 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
11711171 bounds,
11721172 TaggedRef :: new ( lifetime_bound, TraitObjectSyntax :: None ) ,
11731173 ) ;
1174- return hir:: Ty { kind, span : self . lower_span ( t. span ) , hir_id : self . next_id ( ) } ;
1174+ return hir:: Ty {
1175+ kind,
1176+ span : self . lower_span ( t. span ) ,
1177+ hir_id : self . next_id ( ) ,
1178+ source : TySource :: Other ,
1179+ } ;
11751180 }
11761181
11771182 let id = self . lower_node_id ( t. id ) ;
@@ -1188,7 +1193,12 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
11881193 }
11891194
11901195 fn ty ( & mut self , span : Span , kind : hir:: TyKind < ' hir > ) -> hir:: Ty < ' hir > {
1191- hir:: Ty { hir_id : self . next_id ( ) , kind, span : self . lower_span ( span) }
1196+ hir:: Ty {
1197+ hir_id : self . next_id ( ) ,
1198+ kind,
1199+ span : self . lower_span ( span) ,
1200+ source : TySource :: Other ,
1201+ }
11921202 }
11931203
11941204 fn ty_tup ( & mut self , span : Span , tys : & ' hir [ hir:: Ty < ' hir > ] ) -> hir:: Ty < ' hir > {
@@ -1209,7 +1219,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
12091219 let lifetime = self . lower_ty_direct_lifetime ( t, * region) ;
12101220 let kind = hir:: TyKind :: Ref ( lifetime, self . lower_mt ( mt, itctx) ) ;
12111221 let span = self . lower_span ( t. span ) ;
1212- let arg = hir:: Ty { kind, span, hir_id : self . next_id ( ) } ;
1222+ let arg = hir:: Ty { kind, span, hir_id : self . next_id ( ) , source : TySource :: Other } ;
12131223 let args = self . arena . alloc ( hir:: GenericArgs {
12141224 args : self . arena . alloc ( [ hir:: GenericArg :: Type ( self . arena . alloc ( arg) ) ] ) ,
12151225 constraints : & [ ] ,
@@ -1374,7 +1384,12 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
13741384 TyKind :: Dummy => panic ! ( "`TyKind::Dummy` should never be lowered" ) ,
13751385 } ;
13761386
1377- hir:: Ty { kind, span : self . lower_span ( t. span ) , hir_id : self . lower_node_id ( t. id ) }
1387+ hir:: Ty {
1388+ kind,
1389+ span : self . lower_span ( t. span ) ,
1390+ hir_id : self . lower_node_id ( t. id ) ,
1391+ source : TySource :: Other ,
1392+ }
13781393 }
13791394
13801395 fn lower_ty_direct_lifetime (
@@ -2375,7 +2390,17 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
23752390 }
23762391 }
23772392
2378- fn ty_path ( & mut self , mut hir_id : HirId , span : Span , qpath : hir:: QPath < ' hir > ) -> hir:: Ty < ' hir > {
2393+ fn ty_path ( & mut self , hir_id : HirId , span : Span , qpath : hir:: QPath < ' hir > ) -> hir:: Ty < ' hir > {
2394+ self . ty_path_with_source ( hir_id, span, qpath, TySource :: Other )
2395+ }
2396+
2397+ fn ty_path_with_source (
2398+ & mut self ,
2399+ mut hir_id : HirId ,
2400+ span : Span ,
2401+ qpath : hir:: QPath < ' hir > ,
2402+ source : TySource ,
2403+ ) -> hir:: Ty < ' hir > {
23792404 let kind = match qpath {
23802405 hir:: QPath :: Resolved ( None , path) => {
23812406 // Turn trait object paths into `TyKind::TraitObject` instead.
@@ -2402,7 +2427,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
24022427 _ => hir:: TyKind :: Path ( qpath) ,
24032428 } ;
24042429
2405- hir:: Ty { hir_id, kind, span : self . lower_span ( span) }
2430+ hir:: Ty { hir_id, kind, span : self . lower_span ( span) , source }
24062431 }
24072432
24082433 /// Invoked to create the lifetime argument(s) for an elided trait object
0 commit comments