@@ -111,9 +111,6 @@ crate enum RibKind<'a> {
111
111
/// from the default of a type parameter because they're not declared
112
112
/// before said type parameter. Also see the `visit_generics` override.
113
113
ForwardTyParamBanRibKind ,
114
-
115
- /// We forbid the use of type parameters as the types of const parameters.
116
- TyParamAsConstParamTy ,
117
114
}
118
115
119
116
impl RibKind < ' _ > {
@@ -128,8 +125,7 @@ impl RibKind<'_> {
128
125
| MacroDefinition ( _) => false ,
129
126
AssocItemRibKind
130
127
| ItemRibKind ( _)
131
- | ForwardTyParamBanRibKind
132
- | TyParamAsConstParamTy => true ,
128
+ | ForwardTyParamBanRibKind => true ,
133
129
}
134
130
}
135
131
}
@@ -483,18 +479,6 @@ impl<'a, 'tcx> Visitor<'tcx> for LateResolutionVisitor<'a, '_> {
483
479
default_ban_rib. bindings . insert ( Ident :: with_dummy_span ( kw:: SelfUpper ) , Res :: Err ) ;
484
480
}
485
481
486
- // We also ban access to type parameters for use as the types of const parameters.
487
- let mut const_ty_param_ban_rib = Rib :: new ( TyParamAsConstParamTy ) ;
488
- const_ty_param_ban_rib. bindings . extend ( generics. params . iter ( )
489
- . filter ( |param| {
490
- if let GenericParamKind :: Type { .. } = param. kind {
491
- true
492
- } else {
493
- false
494
- }
495
- } )
496
- . map ( |param| ( Ident :: with_dummy_span ( param. ident . name ) , Res :: Err ) ) ) ;
497
-
498
482
for param in & generics. params {
499
483
match param. kind {
500
484
GenericParamKind :: Lifetime { .. } => self . visit_generic_param ( param) ,
@@ -513,15 +497,10 @@ impl<'a, 'tcx> Visitor<'tcx> for LateResolutionVisitor<'a, '_> {
513
497
default_ban_rib. bindings . remove ( & Ident :: with_dummy_span ( param. ident . name ) ) ;
514
498
}
515
499
GenericParamKind :: Const { ref ty } => {
516
- self . ribs [ TypeNS ] . push ( const_ty_param_ban_rib) ;
517
-
518
500
for bound in & param. bounds {
519
501
self . visit_param_bound ( bound) ;
520
502
}
521
-
522
503
self . visit_ty ( ty) ;
523
-
524
- const_ty_param_ban_rib = self . ribs [ TypeNS ] . pop ( ) . unwrap ( ) ;
525
504
}
526
505
}
527
506
}
0 commit comments