@@ -132,10 +132,10 @@ crate enum RibKind<'a> {
132
132
/// We passed through a `macro_rules!` statement
133
133
MacroDefinition ( DefId ) ,
134
134
135
- /// All bindings in this rib are type parameters that can't be used
136
- /// from the default of a type parameter because they're not declared
137
- /// before said type parameter. Also see the `visit_generics` override.
138
- ForwardTyParamBanRibKind ,
135
+ /// All bindings in this rib are generic parameters that can't be used
136
+ /// from the default of a generic parameter because they're not declared
137
+ /// before said generic parameter. Also see the `visit_generics` override.
138
+ ForwardGenericParamBanRibKind ,
139
139
140
140
/// We are inside of the type of a const parameter. Can't refer to any
141
141
/// parameters.
@@ -154,7 +154,7 @@ impl RibKind<'_> {
154
154
| ModuleRibKind ( _)
155
155
| MacroDefinition ( _)
156
156
| ConstParamTyRibKind => false ,
157
- AssocItemRibKind | ItemRibKind ( _) | ForwardTyParamBanRibKind => true ,
157
+ AssocItemRibKind | ItemRibKind ( _) | ForwardGenericParamBanRibKind => true ,
158
158
}
159
159
}
160
160
}
@@ -555,15 +555,16 @@ impl<'a: 'ast, 'ast> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast> {
555
555
// provide previous type parameters as they're built. We
556
556
// put all the parameters on the ban list and then remove
557
557
// them one by one as they are processed and become available.
558
- let mut default_ban_rib = Rib :: new ( ForwardTyParamBanRibKind ) ;
558
+ let mut default_ban_rib = Rib :: new ( ForwardGenericParamBanRibKind ) ;
559
559
let mut found_default = false ;
560
560
default_ban_rib. bindings . extend ( generics. params . iter ( ) . filter_map (
561
561
|param| match param. kind {
562
- GenericParamKind :: Const { .. } | GenericParamKind :: Lifetime { .. } => None ,
563
- GenericParamKind :: Type { ref default, .. } => {
564
- found_default |= default . is_some ( ) ;
565
- found_default . then_some ( ( Ident :: with_dummy_span ( param. ident . name ) , Res :: Err ) )
562
+ GenericParamKind :: Type { default : Some ( _ ) , .. }
563
+ | GenericParamKind :: Const { default : Some ( _ ) , .. } => {
564
+ found_default = true ;
565
+ Some ( ( Ident :: with_dummy_span ( param. ident . name ) , Res :: Err ) )
566
566
}
567
+ _ => None ,
567
568
} ,
568
569
) ) ;
569
570
@@ -591,8 +592,8 @@ impl<'a: 'ast, 'ast> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast> {
591
592
592
593
if let Some ( ref ty) = default {
593
594
self . ribs [ TypeNS ] . push ( default_ban_rib) ;
594
- self . with_rib ( ValueNS , ForwardTyParamBanRibKind , |this| {
595
- // HACK: We use an empty `ForwardTyParamBanRibKind ` here which
595
+ self . with_rib ( ValueNS , ForwardGenericParamBanRibKind , |this| {
596
+ // HACK: We use an empty `ForwardGenericParamBanRibKind ` here which
596
597
// is only used to forbid the use of const parameters inside of
597
598
// type defaults.
598
599
//
@@ -616,7 +617,6 @@ impl<'a: 'ast, 'ast> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast> {
616
617
self . visit_ty ( ty) ;
617
618
self . ribs [ TypeNS ] . pop ( ) . unwrap ( ) ;
618
619
self . ribs [ ValueNS ] . pop ( ) . unwrap ( ) ;
619
- // FIXME(const_generics:default) do something with default here?
620
620
}
621
621
}
622
622
}
@@ -866,7 +866,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
866
866
| ItemRibKind ( ..)
867
867
| ConstantItemRibKind ( ..)
868
868
| ModuleRibKind ( ..)
869
- | ForwardTyParamBanRibKind
869
+ | ForwardGenericParamBanRibKind
870
870
| ConstParamTyRibKind => {
871
871
return false ;
872
872
}
0 commit comments