@@ -110,6 +110,9 @@ crate enum RibKind<'a> {
110110 ItemRibKind ( HasGenericParams ) ,
111111
112112 /// 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.
113116 ConstantItemRibKind ( bool ) ,
114117
115118 /// We passed through a module.
@@ -848,7 +851,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
848851 self . with_current_self_item ( item, |this| {
849852 this. with_generic_param_rib ( generics, ItemRibKind ( HasGenericParams :: Yes ) , |this| {
850853 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| {
852855 visit:: walk_item ( this, item) ;
853856 } ) ;
854857 } ) ;
@@ -1215,7 +1218,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
12151218 // Resolve the trait reference, if necessary.
12161219 this. with_optional_trait_ref ( opt_trait_reference. as_ref ( ) , |this, trait_id| {
12171220 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| {
12191222 if let Some ( trait_ref) = opt_trait_reference. as_ref ( ) {
12201223 // Resolve type arguments in the trait path.
12211224 visit:: walk_trait_ref ( this, trait_ref) ;
0 commit comments