@@ -318,9 +318,8 @@ impl<'tcx> ResolverAstLowering<'tcx> {
318318/// Relaxed bounds should only be allowed in places where we later
319319/// (namely during HIR ty lowering) perform *sized elaboration*.
320320#[ derive( Clone , Copy , Debug ) ]
321- enum RelaxedBoundPolicy < ' a > {
321+ enum RelaxedBoundPolicy {
322322 Allowed ,
323- AllowedIfOnTyParam ( NodeId , & ' a [ ast:: GenericParam ] ) ,
324323 Forbidden ( RelaxedBoundForbiddenReason ) ,
325324}
326325
@@ -1955,7 +1954,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
19551954 fn lower_param_bound (
19561955 & mut self ,
19571956 tpb : & GenericBound ,
1958- rbp : RelaxedBoundPolicy < ' _ > ,
1957+ rbp : RelaxedBoundPolicy ,
19591958 itctx : ImplTraitContext ,
19601959 ) -> hir:: GenericBound < ' hir > {
19611960 match tpb {
@@ -2193,7 +2192,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
21932192 fn lower_poly_trait_ref (
21942193 & mut self ,
21952194 PolyTraitRef { bound_generic_params, modifiers, trait_ref, span, parens : _ } : & PolyTraitRef ,
2196- rbp : RelaxedBoundPolicy < ' _ > ,
2195+ rbp : RelaxedBoundPolicy ,
21972196 itctx : ImplTraitContext ,
21982197 ) -> hir:: PolyTraitRef < ' hir > {
21992198 let bound_generic_params =
@@ -2217,7 +2216,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
22172216 & self ,
22182217 trait_ref : hir:: TraitRef < ' _ > ,
22192218 span : Span ,
2220- rbp : RelaxedBoundPolicy < ' _ > ,
2219+ rbp : RelaxedBoundPolicy ,
22212220 ) {
22222221 // Even though feature `more_maybe_bounds` enables the user to relax all default bounds
22232222 // other than `Sized` in a lot more positions (thereby bypassing the given policy), we don't
@@ -2230,14 +2229,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
22302229
22312230 match rbp {
22322231 RelaxedBoundPolicy :: Allowed => return ,
2233- RelaxedBoundPolicy :: AllowedIfOnTyParam ( id, params) => {
2234- if let Some ( res) = self . get_partial_res ( id) . and_then ( |r| r. full_res ( ) )
2235- && let Res :: Def ( DefKind :: TyParam , def_id) = res
2236- && params. iter ( ) . any ( |p| def_id == self . local_def_id ( p. id ) . to_def_id ( ) )
2237- {
2238- return ;
2239- }
2240- }
22412232 RelaxedBoundPolicy :: Forbidden ( reason) => {
22422233 let gate = |context, subject| {
22432234 let extended = self . tcx . features ( ) . more_maybe_bounds ( ) ;
@@ -2299,7 +2290,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
22992290 fn lower_param_bounds (
23002291 & mut self ,
23012292 bounds : & [ GenericBound ] ,
2302- rbp : RelaxedBoundPolicy < ' _ > ,
2293+ rbp : RelaxedBoundPolicy ,
23032294 itctx : ImplTraitContext ,
23042295 ) -> hir:: GenericBounds < ' hir > {
23052296 self . arena . alloc_from_iter ( self . lower_param_bounds_mut ( bounds, rbp, itctx) )
@@ -2308,7 +2299,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
23082299 fn lower_param_bounds_mut (
23092300 & mut self ,
23102301 bounds : & [ GenericBound ] ,
2311- rbp : RelaxedBoundPolicy < ' _ > ,
2302+ rbp : RelaxedBoundPolicy ,
23122303 itctx : ImplTraitContext ,
23132304 ) -> impl Iterator < Item = hir:: GenericBound < ' hir > > {
23142305 bounds. iter ( ) . map ( move |bound| self . lower_param_bound ( bound, rbp, itctx) )
0 commit comments