@@ -293,18 +293,6 @@ enum ImplTraitPosition {
293
293
ImplReturn ,
294
294
}
295
295
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
-
308
296
impl std:: fmt:: Display for ImplTraitPosition {
309
297
fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
310
298
let name = match self {
@@ -867,20 +855,15 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
867
855
fn lower_assoc_ty_constraint (
868
856
& mut self ,
869
857
constraint : & AssocConstraint ,
870
- mut itctx : ImplTraitContext ,
858
+ itctx : ImplTraitContext ,
871
859
) -> hir:: TypeBinding < ' hir > {
872
860
debug ! ( "lower_assoc_ty_constraint(constraint={:?}, itctx={:?})" , constraint, itctx) ;
873
861
874
862
// lower generic arguments of identifier in constraint
875
863
let gen_args = if let Some ( ref gen_args) = constraint. gen_args {
876
864
let gen_args_ctor = match gen_args {
877
865
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
884
867
}
885
868
GenericArgs :: Parenthesized ( ref data) => {
886
869
let mut err = self . sess . struct_span_err (
@@ -892,7 +875,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
892
875
self . lower_angle_bracketed_parameter_data (
893
876
& data. as_angle_bracketed_args ( ) ,
894
877
ParamMode :: Explicit ,
895
- itctx. reborrow ( ) ,
878
+ itctx,
896
879
)
897
880
. 0
898
881
}
@@ -1097,7 +1080,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1097
1080
self . ty ( span, hir:: TyKind :: Tup ( tys) )
1098
1081
}
1099
1082
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 > {
1101
1084
let kind = match t. kind {
1102
1085
TyKind :: Infer => hir:: TyKind :: Infer ,
1103
1086
TyKind :: Err => hir:: TyKind :: Err ,
@@ -1129,11 +1112,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1129
1112
} ) )
1130
1113
} ) ,
1131
1114
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
+ ) ,
1137
1118
TyKind :: Paren ( ref ty) => {
1138
1119
return self . lower_ty_direct ( ty, itctx) ;
1139
1120
}
@@ -1167,7 +1148,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1167
1148
GenericBound :: Trait (
1168
1149
ref ty,
1169
1150
TraitBoundModifier :: None | TraitBoundModifier :: MaybeConst ,
1170
- ) => Some ( this. lower_poly_trait_ref ( ty, itctx. reborrow ( ) ) ) ,
1151
+ ) => Some ( this. lower_poly_trait_ref ( ty, itctx) ) ,
1171
1152
// `~const ?Bound` will cause an error during AST validation
1172
1153
// anyways, so treat it like `?Bound` as compilation proceeds.
1173
1154
GenericBound :: Trait (
@@ -1935,12 +1916,12 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1935
1916
fn lower_poly_trait_ref (
1936
1917
& mut self ,
1937
1918
p : & PolyTraitRef ,
1938
- mut itctx : ImplTraitContext ,
1919
+ itctx : ImplTraitContext ,
1939
1920
) -> hir:: PolyTraitRef < ' hir > {
1940
1921
let bound_generic_params = self . lower_generic_params ( & p. bound_generic_params ) ;
1941
1922
1942
1923
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)
1944
1925
} ) ;
1945
1926
1946
1927
hir:: PolyTraitRef { bound_generic_params, trait_ref, span : self . lower_span ( p. span ) }
@@ -1961,9 +1942,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1961
1942
fn lower_param_bounds_mut < ' s > (
1962
1943
& ' s mut self ,
1963
1944
bounds : & ' s [ GenericBound ] ,
1964
- mut itctx : ImplTraitContext ,
1945
+ itctx : ImplTraitContext ,
1965
1946
) -> 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) )
1967
1948
}
1968
1949
1969
1950
/// Lowers a block directly to an expression, presuming that it
0 commit comments