@@ -15,8 +15,7 @@ use std::ptr;
1515
1616use crate :: errors:: { ParamKindInEnumDiscriminant , ParamKindInNonTrivialAnonConst } ;
1717use crate :: late:: {
18- ConstantHasGenerics , ConstantItemKind , HasGenericParams , NoConstantGenericsReason , PathSource ,
19- Rib , RibKind ,
18+ ConstantHasGenerics , HasGenericParams , NoConstantGenericsReason , PathSource , Rib , RibKind ,
2019} ;
2120use crate :: macros:: { sub_namespace_match, MacroRulesScope } ;
2221use crate :: { errors, AmbiguityError , AmbiguityErrorMisc , AmbiguityKind , Determinacy , Finalize } ;
@@ -1127,28 +1126,25 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
11271126 RibKind :: ConstantItem ( _, item) => {
11281127 // Still doesn't deal with upvars
11291128 if let Some ( span) = finalize {
1130- let ( span, resolution_error) =
1131- if let Some ( ( ident, constant_item_kind) ) = item {
1132- let kind_str = match constant_item_kind {
1133- ConstantItemKind :: Const => "const" ,
1134- ConstantItemKind :: Static => "static" ,
1135- } ;
1136- (
1137- span,
1138- AttemptToUseNonConstantValueInConstant (
1139- ident, "let" , kind_str,
1140- ) ,
1141- )
1142- } else {
1143- (
1144- rib_ident. span ,
1145- AttemptToUseNonConstantValueInConstant (
1146- original_rib_ident_def,
1147- "const" ,
1148- "let" ,
1149- ) ,
1150- )
1151- } ;
1129+ let ( span, resolution_error) = match item {
1130+ None if rib_ident. as_str ( ) == "self" => ( span, LowercaseSelf ) ,
1131+ None => (
1132+ rib_ident. span ,
1133+ AttemptToUseNonConstantValueInConstant (
1134+ original_rib_ident_def,
1135+ "const" ,
1136+ "let" ,
1137+ ) ,
1138+ ) ,
1139+ Some ( ( ident, kind) ) => (
1140+ span,
1141+ AttemptToUseNonConstantValueInConstant (
1142+ ident,
1143+ "let" ,
1144+ kind. as_str ( ) ,
1145+ ) ,
1146+ ) ,
1147+ } ;
11521148 self . report_error ( span, resolution_error) ;
11531149 }
11541150 return Res :: Err ;
0 commit comments