@@ -2727,19 +2727,21 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
2727
2727
kind : LifetimeBinderKind :: ConstItem ,
2728
2728
} ,
2729
2729
|this| {
2730
- this. visit_generics ( generics) ;
2731
- this. visit_ty ( ty) ;
2732
-
2733
- // Only impose the restrictions of `ConstRibKind` for an
2734
- // actual constant expression in a provided default.
2735
- if let Some ( expr) = expr {
2736
- // We allow arbitrary const expressions inside of associated consts,
2737
- // even if they are potentially not const evaluatable.
2738
- //
2739
- // Type parameters can already be used and as associated consts are
2740
- // not used as part of the type system, this is far less surprising.
2741
- this. resolve_const_body ( expr, None ) ;
2742
- }
2730
+ this. with_lifetime_rib ( LifetimeRibKind :: AnonymousReportError , |this| {
2731
+ this. visit_generics ( generics) ;
2732
+ this. visit_ty ( ty) ;
2733
+
2734
+ // Only impose the restrictions of `ConstRibKind` for an
2735
+ // actual constant expression in a provided default.
2736
+ if let Some ( expr) = expr {
2737
+ // We allow arbitrary const expressions inside of associated consts,
2738
+ // even if they are potentially not const evaluatable.
2739
+ //
2740
+ // Type parameters can already be used and as associated consts are
2741
+ // not used as part of the type system, this is far less surprising.
2742
+ this. resolve_const_body ( expr, None ) ;
2743
+ }
2744
+ } ) ;
2743
2745
} ,
2744
2746
) ;
2745
2747
}
@@ -2898,7 +2900,6 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
2898
2900
match & item. kind {
2899
2901
AssocItemKind :: Const ( box ast:: ConstItem { generics, ty, expr, .. } ) => {
2900
2902
debug ! ( "resolve_implementation AssocItemKind::Const" ) ;
2901
-
2902
2903
self . with_generic_param_rib (
2903
2904
& generics. params ,
2904
2905
RibKind :: AssocItem ,
@@ -2908,28 +2909,30 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
2908
2909
kind : LifetimeBinderKind :: ConstItem ,
2909
2910
} ,
2910
2911
|this| {
2911
- // If this is a trait impl, ensure the const
2912
- // exists in trait
2913
- this. check_trait_item (
2914
- item. id ,
2915
- item. ident ,
2916
- & item. kind ,
2917
- ValueNS ,
2918
- item. span ,
2919
- seen_trait_items,
2920
- |i, s, c| ConstNotMemberOfTrait ( i, s, c) ,
2921
- ) ;
2912
+ this. with_lifetime_rib ( LifetimeRibKind :: AnonymousReportError , |this| {
2913
+ // If this is a trait impl, ensure the const
2914
+ // exists in trait
2915
+ this. check_trait_item (
2916
+ item. id ,
2917
+ item. ident ,
2918
+ & item. kind ,
2919
+ ValueNS ,
2920
+ item. span ,
2921
+ seen_trait_items,
2922
+ |i, s, c| ConstNotMemberOfTrait ( i, s, c) ,
2923
+ ) ;
2922
2924
2923
- this. visit_generics ( generics) ;
2924
- this. visit_ty ( ty) ;
2925
- if let Some ( expr) = expr {
2926
- // We allow arbitrary const expressions inside of associated consts,
2927
- // even if they are potentially not const evaluatable.
2928
- //
2929
- // Type parameters can already be used and as associated consts are
2930
- // not used as part of the type system, this is far less surprising.
2931
- this. resolve_const_body ( expr, None ) ;
2932
- }
2925
+ this. visit_generics ( generics) ;
2926
+ this. visit_ty ( ty) ;
2927
+ if let Some ( expr) = expr {
2928
+ // We allow arbitrary const expressions inside of associated consts,
2929
+ // even if they are potentially not const evaluatable.
2930
+ //
2931
+ // Type parameters can already be used and as associated consts are
2932
+ // not used as part of the type system, this is far less surprising.
2933
+ this. resolve_const_body ( expr, None ) ;
2934
+ }
2935
+ } ) ;
2933
2936
} ,
2934
2937
) ;
2935
2938
}
0 commit comments