@@ -313,8 +313,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
313313 let ( generics, ty) = self . lower_generics (
314314 & generics,
315315 id,
316- & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Generic ) ,
317- |this| this. lower_ty ( ty, & mut ImplTraitContext :: TypeAliasesOpaqueTy ) ,
316+ & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Generic ) ,
317+ |this| this. lower_ty ( ty, & ImplTraitContext :: TypeAliasesOpaqueTy ) ,
318318 ) ;
319319 hir:: ItemKind :: TyAlias ( ty, generics)
320320 }
@@ -326,7 +326,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
326326 let ( generics, ty) = self . lower_generics (
327327 & generics,
328328 id,
329- & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Generic ) ,
329+ & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Generic ) ,
330330 |this| this. arena . alloc ( this. ty ( span, hir:: TyKind :: Err ) ) ,
331331 ) ;
332332 hir:: ItemKind :: TyAlias ( ty, generics)
@@ -335,7 +335,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
335335 let ( generics, variants) = self . lower_generics (
336336 generics,
337337 id,
338- & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Generic ) ,
338+ & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Generic ) ,
339339 |this| {
340340 this. arena . alloc_from_iter (
341341 enum_definition. variants . iter ( ) . map ( |x| this. lower_variant ( x) ) ,
@@ -348,7 +348,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
348348 let ( generics, struct_def) = self . lower_generics (
349349 generics,
350350 id,
351- & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Generic ) ,
351+ & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Generic ) ,
352352 |this| this. lower_variant_data ( hir_id, struct_def) ,
353353 ) ;
354354 hir:: ItemKind :: Struct ( struct_def, generics)
@@ -357,7 +357,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
357357 let ( generics, vdata) = self . lower_generics (
358358 generics,
359359 id,
360- & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Generic ) ,
360+ & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Generic ) ,
361361 |this| this. lower_variant_data ( hir_id, vdata) ,
362362 ) ;
363363 hir:: ItemKind :: Union ( vdata, generics)
@@ -391,14 +391,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
391391 let trait_ref = trait_ref. as_ref ( ) . map ( |trait_ref| {
392392 this. lower_trait_ref (
393393 trait_ref,
394- & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Trait ) ,
394+ & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Trait ) ,
395395 )
396396 } ) ;
397397
398- let lowered_ty = this. lower_ty (
399- ty,
400- & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Type ) ,
401- ) ;
398+ let lowered_ty = this
399+ . lower_ty ( ty, & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Type ) ) ;
402400
403401 ( trait_ref, lowered_ty)
404402 } ) ;
@@ -437,11 +435,11 @@ impl<'hir> LoweringContext<'_, 'hir> {
437435 let ( generics, ( unsafety, items, bounds) ) = self . lower_generics (
438436 generics,
439437 id,
440- & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Generic ) ,
438+ & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Generic ) ,
441439 |this| {
442440 let bounds = this. lower_param_bounds (
443441 bounds,
444- & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Bound ) ,
442+ & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Bound ) ,
445443 ) ;
446444 let items = this. arena . alloc_from_iter (
447445 items. iter ( ) . map ( |item| this. lower_trait_item_ref ( item) ) ,
@@ -456,11 +454,11 @@ impl<'hir> LoweringContext<'_, 'hir> {
456454 let ( generics, bounds) = self . lower_generics (
457455 generics,
458456 id,
459- & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Generic ) ,
457+ & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Generic ) ,
460458 |this| {
461459 this. lower_param_bounds (
462460 bounds,
463- & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Bound ) ,
461+ & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Bound ) ,
464462 )
465463 } ,
466464 ) ;
@@ -483,7 +481,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
483481 span : Span ,
484482 body : Option < & Expr > ,
485483 ) -> ( & ' hir hir:: Ty < ' hir > , hir:: BodyId ) {
486- let ty = self . lower_ty ( ty, & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Type ) ) ;
484+ let ty = self . lower_ty ( ty, & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Type ) ) ;
487485 ( ty, self . lower_const_body ( span, body) )
488486 }
489487
@@ -675,8 +673,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
675673 hir:: ForeignItemKind :: Fn ( fn_dec, fn_args, generics)
676674 }
677675 ForeignItemKind :: Static ( ref t, m, _) => {
678- let ty = self
679- . lower_ty ( t, & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Type ) ) ;
676+ let ty =
677+ self . lower_ty ( t, & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Type ) ) ;
680678 hir:: ForeignItemKind :: Static ( ty, m)
681679 }
682680 ForeignItemKind :: TyAlias ( ..) => hir:: ForeignItemKind :: Type ,
@@ -744,11 +742,11 @@ impl<'hir> LoweringContext<'_, 'hir> {
744742 qself,
745743 path,
746744 ParamMode :: ExplicitNamed , // no `'_` in declarations (Issue #61124)
747- & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Path ) ,
745+ & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Path ) ,
748746 ) ;
749747 self . arena . alloc ( t)
750748 } else {
751- self . lower_ty ( & f. ty , & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Type ) )
749+ self . lower_ty ( & f. ty , & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Type ) )
752750 } ;
753751 let hir_id = self . lower_node_id ( f. id ) ;
754752 self . lower_attrs ( hir_id, & f. attrs ) ;
@@ -771,8 +769,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
771769
772770 let ( generics, kind, has_default) = match i. kind {
773771 AssocItemKind :: Const ( _, ref ty, ref default) => {
774- let ty =
775- self . lower_ty ( ty, & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Type ) ) ;
772+ let ty = self . lower_ty ( ty, & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Type ) ) ;
776773 let body = default. as_ref ( ) . map ( |x| self . lower_const_body ( i. span , Some ( x) ) ) ;
777774 ( hir:: Generics :: empty ( ) , hir:: TraitItemKind :: Const ( ty, body) , body. is_some ( ) )
778775 }
@@ -813,18 +810,15 @@ impl<'hir> LoweringContext<'_, 'hir> {
813810 let ( generics, kind) = self . lower_generics (
814811 & generics,
815812 i. id ,
816- & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Generic ) ,
813+ & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Generic ) ,
817814 |this| {
818815 let ty = ty. as_ref ( ) . map ( |x| {
819- this. lower_ty (
820- x,
821- & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Type ) ,
822- )
816+ this. lower_ty ( x, & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Type ) )
823817 } ) ;
824818 hir:: TraitItemKind :: Type (
825819 this. lower_param_bounds (
826820 bounds,
827- & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Generic ) ,
821+ & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Generic ) ,
828822 ) ,
829823 ty,
830824 )
@@ -877,8 +871,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
877871
878872 let ( generics, kind) = match & i. kind {
879873 AssocItemKind :: Const ( _, ty, expr) => {
880- let ty =
881- self . lower_ty ( ty, & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Type ) ) ;
874+ let ty = self . lower_ty ( ty, & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Type ) ) ;
882875 (
883876 hir:: Generics :: empty ( ) ,
884877 hir:: ImplItemKind :: Const ( ty, self . lower_const_body ( i. span , expr. as_deref ( ) ) ) ,
@@ -905,14 +898,14 @@ impl<'hir> LoweringContext<'_, 'hir> {
905898 self . lower_generics (
906899 & generics,
907900 i. id ,
908- & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Generic ) ,
901+ & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Generic ) ,
909902 |this| match ty {
910903 None => {
911904 let ty = this. arena . alloc ( this. ty ( i. span , hir:: TyKind :: Err ) ) ;
912905 hir:: ImplItemKind :: TyAlias ( ty)
913906 }
914907 Some ( ty) => {
915- let ty = this. lower_ty ( ty, & mut ImplTraitContext :: TypeAliasesOpaqueTy ) ;
908+ let ty = this. lower_ty ( ty, & ImplTraitContext :: TypeAliasesOpaqueTy ) ;
916909 hir:: ImplItemKind :: TyAlias ( ty)
917910 }
918911 } ,
@@ -1322,7 +1315,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
13221315 & mut self ,
13231316 generics : & Generics ,
13241317 parent_node_id : NodeId ,
1325- itctx : & mut ImplTraitContext ,
1318+ itctx : & ImplTraitContext ,
13261319 f : impl FnOnce ( & mut Self ) -> T ,
13271320 ) -> ( & ' hir hir:: Generics < ' hir > , T ) {
13281321 debug_assert ! ( self . impl_trait_defs. is_empty( ) ) ;
@@ -1427,7 +1420,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
14271420 id : NodeId ,
14281421 kind : & GenericParamKind ,
14291422 bounds : & [ GenericBound ] ,
1430- itctx : & mut ImplTraitContext ,
1423+ itctx : & ImplTraitContext ,
14311424 origin : PredicateOrigin ,
14321425 ) -> Option < hir:: WherePredicate < ' hir > > {
14331426 // Do not create a clause if we do not have anything inside it.
@@ -1502,14 +1495,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
15021495 span,
15031496 } ) => hir:: WherePredicate :: BoundPredicate ( hir:: WhereBoundPredicate {
15041497 bound_generic_params : self . lower_generic_params ( bound_generic_params) ,
1505- bounded_ty : self . lower_ty (
1506- bounded_ty,
1507- & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Type ) ,
1508- ) ,
1498+ bounded_ty : self
1499+ . lower_ty ( bounded_ty, & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Type ) ) ,
15091500 bounds : self . arena . alloc_from_iter ( bounds. iter ( ) . map ( |bound| {
15101501 self . lower_param_bound (
15111502 bound,
1512- & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Bound ) ,
1503+ & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Bound ) ,
15131504 )
15141505 } ) ) ,
15151506 span : self . lower_span ( span) ,
@@ -1524,20 +1515,16 @@ impl<'hir> LoweringContext<'_, 'hir> {
15241515 lifetime : self . lower_lifetime ( lifetime) ,
15251516 bounds : self . lower_param_bounds (
15261517 bounds,
1527- & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Bound ) ,
1518+ & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Bound ) ,
15281519 ) ,
15291520 in_where_clause : true ,
15301521 } ) ,
15311522 WherePredicate :: EqPredicate ( WhereEqPredicate { ref lhs_ty, ref rhs_ty, span } ) => {
15321523 hir:: WherePredicate :: EqPredicate ( hir:: WhereEqPredicate {
1533- lhs_ty : self . lower_ty (
1534- lhs_ty,
1535- & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Type ) ,
1536- ) ,
1537- rhs_ty : self . lower_ty (
1538- rhs_ty,
1539- & mut ImplTraitContext :: Disallowed ( ImplTraitPosition :: Type ) ,
1540- ) ,
1524+ lhs_ty : self
1525+ . lower_ty ( lhs_ty, & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Type ) ) ,
1526+ rhs_ty : self
1527+ . lower_ty ( rhs_ty, & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Type ) ) ,
15411528 span : self . lower_span ( span) ,
15421529 } )
15431530 }
0 commit comments