@@ -1125,7 +1125,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
11251125 let kind = match & constraint. kind {
11261126 AssocItemConstraintKind :: Equality { term } => {
11271127 let term = match term {
1128- Term :: Ty ( ty) => self . lower_ty ( ty, itctx) . into ( ) ,
1128+ Term :: Ty ( ty) => self . lower_ty_alloc ( ty, itctx) . into ( ) ,
11291129 Term :: Const ( c) => self . lower_anon_const_to_const_arg ( c) . into ( ) ,
11301130 } ;
11311131 hir:: AssocItemConstraintKind :: Equality { term }
@@ -1250,7 +1250,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
12501250 }
12511251 _ => { }
12521252 }
1253- GenericArg :: Type ( self . lower_ty ( ty, itctx) . try_as_ambig_ty ( ) . unwrap ( ) )
1253+ GenericArg :: Type ( self . lower_ty_alloc ( ty, itctx) . try_as_ambig_ty ( ) . unwrap ( ) )
12541254 }
12551255 ast:: GenericArg :: Const ( ct) => {
12561256 GenericArg :: Const ( self . lower_anon_const_to_const_arg ( ct) . try_as_ambig_ct ( ) . unwrap ( ) )
@@ -1259,8 +1259,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
12591259 }
12601260
12611261 #[ instrument( level = "debug" , skip( self ) ) ]
1262- fn lower_ty ( & mut self , t : & Ty , itctx : ImplTraitContext ) -> & ' hir hir:: Ty < ' hir > {
1263- self . arena . alloc ( self . lower_ty_direct ( t, itctx) )
1262+ fn lower_ty_alloc ( & mut self , t : & Ty , itctx : ImplTraitContext ) -> & ' hir hir:: Ty < ' hir > {
1263+ self . arena . alloc ( self . lower_ty ( t, itctx) )
12641264 }
12651265
12661266 fn lower_path_ty (
@@ -1324,11 +1324,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
13241324 self . ty ( span, hir:: TyKind :: Tup ( tys) )
13251325 }
13261326
1327- fn lower_ty_direct ( & mut self , t : & Ty , itctx : ImplTraitContext ) -> hir:: Ty < ' hir > {
1327+ fn lower_ty ( & mut self , t : & Ty , itctx : ImplTraitContext ) -> hir:: Ty < ' hir > {
13281328 let kind = match & t. kind {
13291329 TyKind :: Infer => hir:: TyKind :: Infer ( ( ) ) ,
13301330 TyKind :: Err ( guar) => hir:: TyKind :: Err ( * guar) ,
1331- TyKind :: Slice ( ty) => hir:: TyKind :: Slice ( self . lower_ty ( ty, itctx) ) ,
1331+ TyKind :: Slice ( ty) => hir:: TyKind :: Slice ( self . lower_ty_alloc ( ty, itctx) ) ,
13321332 TyKind :: Ptr ( mt) => hir:: TyKind :: Ptr ( self . lower_mt ( mt, itctx) ) ,
13331333 TyKind :: Ref ( region, mt) => {
13341334 let lifetime = self . lower_ty_direct_lifetime ( t, * region) ;
@@ -1362,15 +1362,15 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
13621362 let generic_params = self . lower_lifetime_binder ( t. id , & f. generic_params ) ;
13631363 hir:: TyKind :: UnsafeBinder ( self . arena . alloc ( hir:: UnsafeBinderTy {
13641364 generic_params,
1365- inner_ty : self . lower_ty ( & f. inner_ty , itctx) ,
1365+ inner_ty : self . lower_ty_alloc ( & f. inner_ty , itctx) ,
13661366 } ) )
13671367 }
13681368 TyKind :: Never => hir:: TyKind :: Never ,
13691369 TyKind :: Tup ( tys) => hir:: TyKind :: Tup (
1370- self . arena . alloc_from_iter ( tys. iter ( ) . map ( |ty| self . lower_ty_direct ( ty, itctx) ) ) ,
1370+ self . arena . alloc_from_iter ( tys. iter ( ) . map ( |ty| self . lower_ty ( ty, itctx) ) ) ,
13711371 ) ,
13721372 TyKind :: Paren ( ty) => {
1373- return self . lower_ty_direct ( ty, itctx) ;
1373+ return self . lower_ty ( ty, itctx) ;
13741374 }
13751375 TyKind :: Path ( qself, path) => {
13761376 return self . lower_path_ty ( t, qself, path, ParamMode :: Explicit , itctx) ;
@@ -1393,7 +1393,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
13931393 ) )
13941394 }
13951395 TyKind :: Array ( ty, length) => hir:: TyKind :: Array (
1396- self . lower_ty ( ty, itctx) ,
1396+ self . lower_ty_alloc ( ty, itctx) ,
13971397 self . lower_array_length_to_const_arg ( length) ,
13981398 ) ,
13991399 TyKind :: TraitObject ( bounds, kind) => {
@@ -1493,7 +1493,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
14931493 }
14941494 }
14951495 TyKind :: Pat ( ty, pat) => {
1496- hir:: TyKind :: Pat ( self . lower_ty ( ty, itctx) , self . lower_ty_pat ( pat, ty. span ) )
1496+ hir:: TyKind :: Pat ( self . lower_ty_alloc ( ty, itctx) , self . lower_ty_pat ( pat, ty. span ) )
14971497 }
14981498 TyKind :: MacCall ( _) => {
14991499 span_bug ! ( t. span, "`TyKind::MacCall` should have been expanded by now" )
@@ -1693,7 +1693,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
16931693 ImplTraitContext :: Disallowed ( ImplTraitPosition :: PointerParam )
16941694 }
16951695 } ;
1696- self . lower_ty_direct ( & param. ty , itctx)
1696+ self . lower_ty ( & param. ty , itctx)
16971697 } ) ) ;
16981698
16991699 let output = match coro {
@@ -1732,7 +1732,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
17321732 ImplTraitContext :: Disallowed ( ImplTraitPosition :: PointerReturn )
17331733 }
17341734 } ;
1735- hir:: FnRetTy :: Return ( self . lower_ty ( ty, itctx) )
1735+ hir:: FnRetTy :: Return ( self . lower_ty_alloc ( ty, itctx) )
17361736 }
17371737 FnRetTy :: Default ( span) => hir:: FnRetTy :: DefaultReturn ( self . lower_span ( * span) ) ,
17381738 } ,
@@ -1843,7 +1843,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
18431843 // Not `OpaqueTyOrigin::AsyncFn`: that's only used for the
18441844 // `impl Future` opaque type that `async fn` implicitly
18451845 // generates.
1846- self . lower_ty ( ty, itctx)
1846+ self . lower_ty_alloc ( ty, itctx)
18471847 }
18481848 FnRetTy :: Default ( ret_ty_span) => self . arena . alloc ( self . ty_tup ( * ret_ty_span, & [ ] ) ) ,
18491849 } ;
@@ -2036,7 +2036,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
20362036 }
20372037 } )
20382038 . map ( |def| {
2039- self . lower_ty (
2039+ self . lower_ty_alloc (
20402040 def,
20412041 ImplTraitContext :: Disallowed ( ImplTraitPosition :: GenericDefault ) ,
20422042 )
@@ -2047,8 +2047,10 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
20472047 ( hir:: ParamName :: Plain ( self . lower_ident ( param. ident ) ) , kind)
20482048 }
20492049 GenericParamKind :: Const { ty, span : _, default } => {
2050- let ty = self
2051- . lower_ty ( ty, ImplTraitContext :: Disallowed ( ImplTraitPosition :: GenericDefault ) ) ;
2050+ let ty = self . lower_ty_alloc (
2051+ ty,
2052+ ImplTraitContext :: Disallowed ( ImplTraitPosition :: GenericDefault ) ,
2053+ ) ;
20522054
20532055 // Not only do we deny const param defaults in binders but we also map them to `None`
20542056 // since later compiler stages cannot handle them (and shouldn't need to be able to).
@@ -2198,7 +2200,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
21982200 }
21992201
22002202 fn lower_mt ( & mut self , mt : & MutTy , itctx : ImplTraitContext ) -> hir:: MutTy < ' hir > {
2201- hir:: MutTy { ty : self . lower_ty ( & mt. ty , itctx) , mutbl : mt. mutbl }
2203+ hir:: MutTy { ty : self . lower_ty_alloc ( & mt. ty , itctx) , mutbl : mt. mutbl }
22022204 }
22032205
22042206 #[ instrument( level = "debug" , skip( self ) , ret) ]
0 commit comments