@@ -210,7 +210,11 @@ enum ResolutionError<'a> {
210
210
/// Error E0434: can't capture dynamic environment in a fn item.
211
211
CannotCaptureDynamicEnvironmentInFnItem ,
212
212
/// 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
+ ) ,
214
218
/// Error E0530: `X` bindings cannot shadow `Y`s.
215
219
BindingShadowsSomethingUnacceptable ( & ' static str , Symbol , & ' a NameBinding < ' a > ) ,
216
220
/// Error E0128: type parameters with a default cannot use forward-declared identifiers.
@@ -1443,7 +1447,7 @@ impl<'a> Resolver<'a> {
1443
1447
}
1444
1448
1445
1449
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 ( ) )
1447
1451
}
1448
1452
1449
1453
fn macro_def ( & self , mut ctxt : SyntaxContext ) -> DefId {
@@ -2010,7 +2014,7 @@ impl<'a> Resolver<'a> {
2010
2014
// The macro is a proc macro derive
2011
2015
if let Some ( def_id) = module. expansion . expn_data ( ) . macro_def_id {
2012
2016
let ext = self . get_macro_by_def_id ( def_id) ;
2013
- if ! ext. is_builtin
2017
+ if ext. builtin_name . is_none ( )
2014
2018
&& ext. macro_kind ( ) == MacroKind :: Derive
2015
2019
&& parent. expansion . outer_expn_is_descendant_of ( span. ctxt ( ) )
2016
2020
{
@@ -2614,18 +2618,19 @@ impl<'a> Resolver<'a> {
2614
2618
ConstantItemKind :: Const => "const" ,
2615
2619
ConstantItemKind :: Static => "static" ,
2616
2620
} ;
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
+ )
2622
2627
} else {
2623
- let sugg = "consider using `const` instead of `let`" ;
2624
2628
(
2625
2629
rib_ident. span ,
2626
2630
AttemptToUseNonConstantValueInConstant (
2627
2631
original_rib_ident_def,
2628
- sugg. to_string ( ) ,
2632
+ "const" ,
2633
+ "let" ,
2629
2634
) ,
2630
2635
)
2631
2636
} ;
0 commit comments