@@ -110,6 +110,9 @@ crate enum RibKind<'a> {
110
110
ItemRibKind ( HasGenericParams ) ,
111
111
112
112
/// We're in a constant item. Can't refer to dynamic stuff.
113
+ ///
114
+ /// The `bool` indicates if this constant may reference generic parameters
115
+ /// and is used to only allow generic parameters to be used in trivial constant expressions.
113
116
ConstantItemRibKind ( bool ) ,
114
117
115
118
/// We passed through a module.
@@ -848,7 +851,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
848
851
self . with_current_self_item ( item, |this| {
849
852
this. with_generic_param_rib ( generics, ItemRibKind ( HasGenericParams :: Yes ) , |this| {
850
853
let item_def_id = this. r . local_def_id ( item. id ) . to_def_id ( ) ;
851
- this. with_self_rib ( Res :: SelfTy ( None , Some ( item_def_id) ) , |this| {
854
+ this. with_self_rib ( Res :: SelfTy ( None , Some ( ( item_def_id, false ) ) ) , |this| {
852
855
visit:: walk_item ( this, item) ;
853
856
} ) ;
854
857
} ) ;
@@ -1215,7 +1218,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
1215
1218
// Resolve the trait reference, if necessary.
1216
1219
this. with_optional_trait_ref ( opt_trait_reference. as_ref ( ) , |this, trait_id| {
1217
1220
let item_def_id = this. r . local_def_id ( item_id) . to_def_id ( ) ;
1218
- this. with_self_rib ( Res :: SelfTy ( trait_id, Some ( item_def_id) ) , |this| {
1221
+ this. with_self_rib ( Res :: SelfTy ( trait_id, Some ( ( item_def_id, false ) ) ) , |this| {
1219
1222
if let Some ( trait_ref) = opt_trait_reference. as_ref ( ) {
1220
1223
// Resolve type arguments in the trait path.
1221
1224
visit:: walk_trait_ref ( this, trait_ref) ;
0 commit comments