@@ -293,18 +293,6 @@ enum ImplTraitPosition {
293293 ImplReturn ,
294294}
295295
296- impl ImplTraitContext {
297- fn reborrow < ' this > ( & ' this mut self ) -> ImplTraitContext {
298- use self :: ImplTraitContext :: * ;
299- match self {
300- Universal ( parent) => Universal ( * parent) ,
301- ReturnPositionOpaqueTy { origin } => ReturnPositionOpaqueTy { origin : * origin } ,
302- TypeAliasesOpaqueTy => TypeAliasesOpaqueTy ,
303- Disallowed ( pos) => Disallowed ( * pos) ,
304- }
305- }
306- }
307-
308296impl std:: fmt:: Display for ImplTraitPosition {
309297 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
310298 let name = match self {
@@ -867,20 +855,15 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
867855 fn lower_assoc_ty_constraint (
868856 & mut self ,
869857 constraint : & AssocConstraint ,
870- mut itctx : ImplTraitContext ,
858+ itctx : ImplTraitContext ,
871859 ) -> hir:: TypeBinding < ' hir > {
872860 debug ! ( "lower_assoc_ty_constraint(constraint={:?}, itctx={:?})" , constraint, itctx) ;
873861
874862 // lower generic arguments of identifier in constraint
875863 let gen_args = if let Some ( ref gen_args) = constraint. gen_args {
876864 let gen_args_ctor = match gen_args {
877865 GenericArgs :: AngleBracketed ( ref data) => {
878- self . lower_angle_bracketed_parameter_data (
879- data,
880- ParamMode :: Explicit ,
881- itctx. reborrow ( ) ,
882- )
883- . 0
866+ self . lower_angle_bracketed_parameter_data ( data, ParamMode :: Explicit , itctx) . 0
884867 }
885868 GenericArgs :: Parenthesized ( ref data) => {
886869 let mut err = self . sess . struct_span_err (
@@ -892,7 +875,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
892875 self . lower_angle_bracketed_parameter_data (
893876 & data. as_angle_bracketed_args ( ) ,
894877 ParamMode :: Explicit ,
895- itctx. reborrow ( ) ,
878+ itctx,
896879 )
897880 . 0
898881 }
@@ -1097,7 +1080,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
10971080 self . ty ( span, hir:: TyKind :: Tup ( tys) )
10981081 }
10991082
1100- fn lower_ty_direct ( & mut self , t : & Ty , mut itctx : ImplTraitContext ) -> hir:: Ty < ' hir > {
1083+ fn lower_ty_direct ( & mut self , t : & Ty , itctx : ImplTraitContext ) -> hir:: Ty < ' hir > {
11011084 let kind = match t. kind {
11021085 TyKind :: Infer => hir:: TyKind :: Infer ,
11031086 TyKind :: Err => hir:: TyKind :: Err ,
@@ -1129,11 +1112,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
11291112 } ) )
11301113 } ) ,
11311114 TyKind :: Never => hir:: TyKind :: Never ,
1132- TyKind :: Tup ( ref tys) => {
1133- hir:: TyKind :: Tup ( self . arena . alloc_from_iter (
1134- tys. iter ( ) . map ( |ty| self . lower_ty_direct ( ty, itctx. reborrow ( ) ) ) ,
1135- ) )
1136- }
1115+ TyKind :: Tup ( ref tys) => hir:: TyKind :: Tup (
1116+ self . arena . alloc_from_iter ( tys. iter ( ) . map ( |ty| self . lower_ty_direct ( ty, itctx) ) ) ,
1117+ ) ,
11371118 TyKind :: Paren ( ref ty) => {
11381119 return self . lower_ty_direct ( ty, itctx) ;
11391120 }
@@ -1167,7 +1148,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
11671148 GenericBound :: Trait (
11681149 ref ty,
11691150 TraitBoundModifier :: None | TraitBoundModifier :: MaybeConst ,
1170- ) => Some ( this. lower_poly_trait_ref ( ty, itctx. reborrow ( ) ) ) ,
1151+ ) => Some ( this. lower_poly_trait_ref ( ty, itctx) ) ,
11711152 // `~const ?Bound` will cause an error during AST validation
11721153 // anyways, so treat it like `?Bound` as compilation proceeds.
11731154 GenericBound :: Trait (
@@ -1935,12 +1916,12 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
19351916 fn lower_poly_trait_ref (
19361917 & mut self ,
19371918 p : & PolyTraitRef ,
1938- mut itctx : ImplTraitContext ,
1919+ itctx : ImplTraitContext ,
19391920 ) -> hir:: PolyTraitRef < ' hir > {
19401921 let bound_generic_params = self . lower_generic_params ( & p. bound_generic_params ) ;
19411922
19421923 let trait_ref = self . with_lifetime_binder ( p. trait_ref . ref_id , |this| {
1943- this. lower_trait_ref ( & p. trait_ref , itctx. reborrow ( ) )
1924+ this. lower_trait_ref ( & p. trait_ref , itctx)
19441925 } ) ;
19451926
19461927 hir:: PolyTraitRef { bound_generic_params, trait_ref, span : self . lower_span ( p. span ) }
@@ -1961,9 +1942,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
19611942 fn lower_param_bounds_mut < ' s > (
19621943 & ' s mut self ,
19631944 bounds : & ' s [ GenericBound ] ,
1964- mut itctx : ImplTraitContext ,
1945+ itctx : ImplTraitContext ,
19651946 ) -> impl Iterator < Item = hir:: GenericBound < ' hir > > + Captures < ' s > + Captures < ' a > {
1966- bounds. iter ( ) . map ( move |bound| self . lower_param_bound ( bound, itctx. reborrow ( ) ) )
1947+ bounds. iter ( ) . map ( move |bound| self . lower_param_bound ( bound, itctx) )
19671948 }
19681949
19691950 /// Lowers a block directly to an expression, presuming that it
0 commit comments