@@ -264,8 +264,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
264264 define_opaque,
265265 } ) => {
266266 let ident = self . lower_ident ( * ident) ;
267- let ty =
268- self . lower_ty ( ty, ImplTraitContext :: Disallowed ( ImplTraitPosition :: StaticTy ) ) ;
267+ let ty = self
268+ . lower_ty_alloc ( ty, ImplTraitContext :: Disallowed ( ImplTraitPosition :: StaticTy ) ) ;
269269 let body_id = self . lower_const_body ( span, e. as_deref ( ) ) ;
270270 self . lower_define_opaque ( hir_id, define_opaque) ;
271271 hir:: ItemKind :: Static ( * m, ident, ty, body_id)
@@ -279,8 +279,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
279279 id,
280280 ImplTraitContext :: Disallowed ( ImplTraitPosition :: Generic ) ,
281281 |this| {
282- let ty = this
283- . lower_ty ( ty, ImplTraitContext :: Disallowed ( ImplTraitPosition :: ConstTy ) ) ;
282+ let ty = this. lower_ty_alloc (
283+ ty,
284+ ImplTraitContext :: Disallowed ( ImplTraitPosition :: ConstTy ) ,
285+ ) ;
284286 let rhs = this. lower_const_item_rhs ( attrs, rhs. as_ref ( ) , span) ;
285287 ( ty, rhs)
286288 } ,
@@ -379,7 +381,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
379381 ) ;
380382 this. arena . alloc ( this. ty ( span, hir:: TyKind :: Err ( guar) ) )
381383 }
382- Some ( ty) => this. lower_ty (
384+ Some ( ty) => this. lower_ty_alloc (
383385 ty,
384386 ImplTraitContext :: OpaqueTy {
385387 origin : hir:: OpaqueTyOrigin :: TyAlias {
@@ -453,7 +455,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
453455 . as_deref ( )
454456 . map ( |of_trait| this. lower_trait_impl_header ( of_trait) ) ;
455457
456- let lowered_ty = this. lower_ty (
458+ let lowered_ty = this. lower_ty_alloc (
457459 ty,
458460 ImplTraitContext :: Disallowed ( ImplTraitPosition :: ImplSelf ) ,
459461 ) ;
@@ -758,8 +760,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
758760 safety,
759761 define_opaque,
760762 } ) => {
761- let ty =
762- self . lower_ty ( ty, ImplTraitContext :: Disallowed ( ImplTraitPosition :: StaticTy ) ) ;
763+ let ty = self
764+ . lower_ty_alloc ( ty, ImplTraitContext :: Disallowed ( ImplTraitPosition :: StaticTy ) ) ;
763765 let safety = self . lower_safety ( * safety, hir:: Safety :: Unsafe ) ;
764766 if define_opaque. is_some ( ) {
765767 self . dcx ( ) . span_err ( i. span , "foreign statics cannot define opaque types" ) ;
@@ -870,7 +872,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
870872 & mut self ,
871873 ( index, f) : ( usize , & FieldDef ) ,
872874 ) -> hir:: FieldDef < ' hir > {
873- let ty = self . lower_ty ( & f. ty , ImplTraitContext :: Disallowed ( ImplTraitPosition :: FieldTy ) ) ;
875+ let ty =
876+ self . lower_ty_alloc ( & f. ty , ImplTraitContext :: Disallowed ( ImplTraitPosition :: FieldTy ) ) ;
874877 let hir_id = self . lower_node_id ( f. id ) ;
875878 self . lower_attrs ( hir_id, & f. attrs , f. span , Target :: Field ) ;
876879 hir:: FieldDef {
@@ -908,8 +911,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
908911 i. id ,
909912 ImplTraitContext :: Disallowed ( ImplTraitPosition :: Generic ) ,
910913 |this| {
911- let ty = this
912- . lower_ty ( ty, ImplTraitContext :: Disallowed ( ImplTraitPosition :: ConstTy ) ) ;
914+ let ty = this. lower_ty_alloc (
915+ ty,
916+ ImplTraitContext :: Disallowed ( ImplTraitPosition :: ConstTy ) ,
917+ ) ;
913918 let rhs = rhs
914919 . as_ref ( )
915920 . map ( |rhs| this. lower_const_item_rhs ( attrs, Some ( rhs) , i. span ) ) ;
@@ -1008,7 +1013,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
10081013 ImplTraitContext :: Disallowed ( ImplTraitPosition :: Generic ) ,
10091014 |this| {
10101015 let ty = ty. as_ref ( ) . map ( |x| {
1011- this. lower_ty (
1016+ this. lower_ty_alloc (
10121017 x,
10131018 ImplTraitContext :: Disallowed ( ImplTraitPosition :: AssocTy ) ,
10141019 )
@@ -1120,8 +1125,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
11201125 i. id ,
11211126 ImplTraitContext :: Disallowed ( ImplTraitPosition :: Generic ) ,
11221127 |this| {
1123- let ty = this
1124- . lower_ty ( ty, ImplTraitContext :: Disallowed ( ImplTraitPosition :: ConstTy ) ) ;
1128+ let ty = this. lower_ty_alloc (
1129+ ty,
1130+ ImplTraitContext :: Disallowed ( ImplTraitPosition :: ConstTy ) ,
1131+ ) ;
11251132 this. lower_define_opaque ( hir_id, & define_opaque) ;
11261133 let rhs = this. lower_const_item_rhs ( attrs, rhs. as_ref ( ) , i. span ) ;
11271134 hir:: ImplItemKind :: Const ( ty, rhs)
@@ -1180,7 +1187,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
11801187 hir:: ImplItemKind :: Type ( ty)
11811188 }
11821189 Some ( ty) => {
1183- let ty = this. lower_ty (
1190+ let ty = this. lower_ty_alloc (
11841191 ty,
11851192 ImplTraitContext :: OpaqueTy {
11861193 origin : hir:: OpaqueTyOrigin :: TyAlias {
@@ -1916,7 +1923,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
19161923 bound_generic_params,
19171924 hir:: GenericParamSource :: Binder ,
19181925 ) ,
1919- bounded_ty : self . lower_ty (
1926+ bounded_ty : self . lower_ty_alloc (
19201927 bounded_ty,
19211928 ImplTraitContext :: Disallowed ( ImplTraitPosition :: Bound ) ,
19221929 ) ,
@@ -1945,10 +1952,14 @@ impl<'hir> LoweringContext<'_, 'hir> {
19451952 }
19461953 WherePredicateKind :: EqPredicate ( WhereEqPredicate { lhs_ty, rhs_ty } ) => {
19471954 hir:: WherePredicateKind :: EqPredicate ( hir:: WhereEqPredicate {
1948- lhs_ty : self
1949- . lower_ty ( lhs_ty, ImplTraitContext :: Disallowed ( ImplTraitPosition :: Bound ) ) ,
1950- rhs_ty : self
1951- . lower_ty ( rhs_ty, ImplTraitContext :: Disallowed ( ImplTraitPosition :: Bound ) ) ,
1955+ lhs_ty : self . lower_ty_alloc (
1956+ lhs_ty,
1957+ ImplTraitContext :: Disallowed ( ImplTraitPosition :: Bound ) ,
1958+ ) ,
1959+ rhs_ty : self . lower_ty_alloc (
1960+ rhs_ty,
1961+ ImplTraitContext :: Disallowed ( ImplTraitPosition :: Bound ) ,
1962+ ) ,
19521963 } )
19531964 }
19541965 } ) ;
0 commit comments