@@ -210,7 +210,11 @@ enum ResolutionError<'a> {
210210 /// Error E0434: can't capture dynamic environment in a fn item.
211211 CannotCaptureDynamicEnvironmentInFnItem ,
212212 /// Error E0435: attempt to use a non-constant value in a constant.
213- AttemptToUseNonConstantValueInConstant ( Ident , String ) ,
213+ AttemptToUseNonConstantValueInConstant (
214+ Ident ,
215+ /* suggestion */ & ' static str ,
216+ /* current */ & ' static str ,
217+ ) ,
214218 /// Error E0530: `X` bindings cannot shadow `Y`s.
215219 BindingShadowsSomethingUnacceptable ( & ' static str , Symbol , & ' a NameBinding < ' a > ) ,
216220 /// Error E0128: type parameters with a default cannot use forward-declared identifiers.
@@ -1443,7 +1447,7 @@ impl<'a> Resolver<'a> {
14431447 }
14441448
14451449 fn is_builtin_macro ( & mut self , res : Res ) -> bool {
1446- self . get_macro ( res) . map_or ( false , |ext| ext. is_builtin )
1450+ self . get_macro ( res) . map_or ( false , |ext| ext. builtin_name . is_some ( ) )
14471451 }
14481452
14491453 fn macro_def ( & self , mut ctxt : SyntaxContext ) -> DefId {
@@ -2010,7 +2014,7 @@ impl<'a> Resolver<'a> {
20102014 // The macro is a proc macro derive
20112015 if let Some ( def_id) = module. expansion . expn_data ( ) . macro_def_id {
20122016 let ext = self . get_macro_by_def_id ( def_id) ;
2013- if ! ext. is_builtin
2017+ if ext. builtin_name . is_none ( )
20142018 && ext. macro_kind ( ) == MacroKind :: Derive
20152019 && parent. expansion . outer_expn_is_descendant_of ( span. ctxt ( ) )
20162020 {
@@ -2614,18 +2618,19 @@ impl<'a> Resolver<'a> {
26142618 ConstantItemKind :: Const => "const" ,
26152619 ConstantItemKind :: Static => "static" ,
26162620 } ;
2617- let sugg = format ! (
2618- "consider using `let` instead of `{}`" ,
2619- kind_str
2620- ) ;
2621- ( span, AttemptToUseNonConstantValueInConstant ( ident, sugg) )
2621+ (
2622+ span,
2623+ AttemptToUseNonConstantValueInConstant (
2624+ ident, "let" , kind_str,
2625+ ) ,
2626+ )
26222627 } else {
2623- let sugg = "consider using `const` instead of `let`" ;
26242628 (
26252629 rib_ident. span ,
26262630 AttemptToUseNonConstantValueInConstant (
26272631 original_rib_ident_def,
2628- sugg. to_string ( ) ,
2632+ "const" ,
2633+ "let" ,
26292634 ) ,
26302635 )
26312636 } ;
0 commit comments