@@ -313,14 +313,23 @@ fn mk_decls(cx: &mut ExtCtxt<'_>, macros: &[ProcMacro]) -> P<ast::Item> {
313
313
match m {
314
314
ProcMacro :: Derive ( cd) => {
315
315
cx. resolver . declare_proc_macro ( cd. id ) ;
316
- cx. expr_call ( span, proc_macro_ty_method_path ( cx, custom_derive) , thin_vec ! [
317
- cx. expr_str( span, cd. trait_name) ,
318
- cx. expr_array_ref(
319
- span,
320
- cd. attrs. iter( ) . map( |& s| cx. expr_str( span, s) ) . collect:: <ThinVec <_>>( ) ,
321
- ) ,
322
- local_path( cx, cd. function_name) ,
323
- ] )
316
+ // The call needs to use `harness_span` so that the const stability checker
317
+ // accepts it.
318
+ cx. expr_call (
319
+ harness_span,
320
+ proc_macro_ty_method_path ( cx, custom_derive) ,
321
+ thin_vec ! [
322
+ cx. expr_str( span, cd. trait_name) ,
323
+ cx. expr_array_ref(
324
+ span,
325
+ cd. attrs
326
+ . iter( )
327
+ . map( |& s| cx. expr_str( span, s) )
328
+ . collect:: <ThinVec <_>>( ) ,
329
+ ) ,
330
+ local_path( cx, cd. function_name) ,
331
+ ] ,
332
+ )
324
333
}
325
334
ProcMacro :: Attr ( ca) | ProcMacro :: Bang ( ca) => {
326
335
cx. resolver . declare_proc_macro ( ca. id ) ;
@@ -330,7 +339,9 @@ fn mk_decls(cx: &mut ExtCtxt<'_>, macros: &[ProcMacro]) -> P<ast::Item> {
330
339
ProcMacro :: Derive ( _) => unreachable ! ( ) ,
331
340
} ;
332
341
333
- cx. expr_call ( span, proc_macro_ty_method_path ( cx, ident) , thin_vec ! [
342
+ // The call needs to use `harness_span` so that the const stability checker
343
+ // accepts it.
344
+ cx. expr_call ( harness_span, proc_macro_ty_method_path ( cx, ident) , thin_vec ! [
334
345
cx. expr_str( span, ca. function_name. name) ,
335
346
local_path( cx, ca. function_name) ,
336
347
] )
0 commit comments