@@ -15,8 +15,7 @@ use std::ptr;
15
15
16
16
use crate :: errors:: { ParamKindInEnumDiscriminant , ParamKindInNonTrivialAnonConst } ;
17
17
use crate :: late:: {
18
- ConstantHasGenerics , ConstantItemKind , HasGenericParams , NoConstantGenericsReason , PathSource ,
19
- Rib , RibKind ,
18
+ ConstantHasGenerics , HasGenericParams , NoConstantGenericsReason , PathSource , Rib , RibKind ,
20
19
} ;
21
20
use crate :: macros:: { sub_namespace_match, MacroRulesScope } ;
22
21
use crate :: { errors, AmbiguityError , AmbiguityErrorMisc , AmbiguityKind , Determinacy , Finalize } ;
@@ -1127,28 +1126,25 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
1127
1126
RibKind :: ConstantItem ( _, item) => {
1128
1127
// Still doesn't deal with upvars
1129
1128
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
+ } ;
1152
1148
self . report_error ( span, resolution_error) ;
1153
1149
}
1154
1150
return Res :: Err ;
0 commit comments