@@ -132,10 +132,10 @@ crate enum RibKind<'a> {
132132 /// We passed through a `macro_rules!` statement
133133 MacroDefinition ( DefId ) ,
134134
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 ,
139139
140140 /// We are inside of the type of a const parameter. Can't refer to any
141141 /// parameters.
@@ -154,7 +154,7 @@ impl RibKind<'_> {
154154 | ModuleRibKind ( _)
155155 | MacroDefinition ( _)
156156 | ConstParamTyRibKind => false ,
157- AssocItemRibKind | ItemRibKind ( _) | ForwardTyParamBanRibKind => true ,
157+ AssocItemRibKind | ItemRibKind ( _) | ForwardGenericParamBanRibKind => true ,
158158 }
159159 }
160160}
@@ -555,15 +555,16 @@ impl<'a: 'ast, 'ast> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast> {
555555 // provide previous type parameters as they're built. We
556556 // put all the parameters on the ban list and then remove
557557 // 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 ) ;
559559 let mut found_default = false ;
560560 default_ban_rib. bindings . extend ( generics. params . iter ( ) . filter_map (
561561 |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 ) )
566566 }
567+ _ => None ,
567568 } ,
568569 ) ) ;
569570
@@ -591,8 +592,8 @@ impl<'a: 'ast, 'ast> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast> {
591592
592593 if let Some ( ref ty) = default {
593594 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
596597 // is only used to forbid the use of const parameters inside of
597598 // type defaults.
598599 //
@@ -616,7 +617,6 @@ impl<'a: 'ast, 'ast> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast> {
616617 self . visit_ty ( ty) ;
617618 self . ribs [ TypeNS ] . pop ( ) . unwrap ( ) ;
618619 self . ribs [ ValueNS ] . pop ( ) . unwrap ( ) ;
619- // FIXME(const_generics:default) do something with default here?
620620 }
621621 }
622622 }
@@ -866,7 +866,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
866866 | ItemRibKind ( ..)
867867 | ConstantItemRibKind ( ..)
868868 | ModuleRibKind ( ..)
869- | ForwardTyParamBanRibKind
869+ | ForwardGenericParamBanRibKind
870870 | ConstParamTyRibKind => {
871871 return false ;
872872 }
0 commit comments