@@ -288,7 +288,8 @@ impl<'a> base::Resolver for Resolver<'a> {
288
288
289
289
// Derives are not included when `invocations` are collected, so we have to add them here.
290
290
let parent_scope = & ParentScope { derives, ..parent_scope } ;
291
- let ( ext, res) = self . smart_resolve_macro_path ( path, kind, parent_scope, force) ?;
291
+ let node_id = self . lint_node_id ( eager_expansion_root) ;
292
+ let ( ext, res) = self . smart_resolve_macro_path ( path, kind, parent_scope, node_id, force) ?;
292
293
293
294
let span = invoc. span ( ) ;
294
295
invoc_id. set_expn_data ( ext. expn_data (
@@ -338,6 +339,10 @@ impl<'a> base::Resolver for Resolver<'a> {
338
339
}
339
340
}
340
341
342
+ fn lint_node_id ( & mut self , expn_id : ExpnId ) -> NodeId {
343
+ self . definitions . lint_node_id ( expn_id)
344
+ }
345
+
341
346
fn has_derive_copy ( & self , expn_id : ExpnId ) -> bool {
342
347
self . containers_deriving_copy . contains ( & expn_id)
343
348
}
@@ -390,6 +395,7 @@ impl<'a> Resolver<'a> {
390
395
path : & ast:: Path ,
391
396
kind : MacroKind ,
392
397
parent_scope : & ParentScope < ' a > ,
398
+ node_id : NodeId ,
393
399
force : bool ,
394
400
) -> Result < ( Lrc < SyntaxExtension > , Res ) , Indeterminate > {
395
401
let ( ext, res) = match self . resolve_macro_path ( path, Some ( kind) , parent_scope, true , force)
@@ -430,7 +436,7 @@ impl<'a> Resolver<'a> {
430
436
_ => panic ! ( "expected `DefKind::Macro` or `Res::NonMacroAttr`" ) ,
431
437
} ;
432
438
433
- self . check_stability_and_deprecation ( & ext, path) ;
439
+ self . check_stability_and_deprecation ( & ext, path, node_id ) ;
434
440
435
441
Ok ( if ext. macro_kind ( ) != kind {
436
442
let expected = kind. descr_expected ( ) ;
@@ -984,13 +990,17 @@ impl<'a> Resolver<'a> {
984
990
}
985
991
}
986
992
987
- fn check_stability_and_deprecation ( & mut self , ext : & SyntaxExtension , path : & ast:: Path ) {
993
+ fn check_stability_and_deprecation (
994
+ & mut self ,
995
+ ext : & SyntaxExtension ,
996
+ path : & ast:: Path ,
997
+ node_id : NodeId ,
998
+ ) {
988
999
let span = path. span ;
989
1000
if let Some ( stability) = & ext. stability {
990
1001
if let StabilityLevel :: Unstable { reason, issue, is_soft } = stability. level {
991
1002
let feature = stability. feature ;
992
1003
if !self . active_features . contains ( & feature) && !span. allows_unstable ( feature) {
993
- let node_id = ast:: CRATE_NODE_ID ;
994
1004
let lint_buffer = & mut self . lint_buffer ;
995
1005
let soft_handler =
996
1006
|lint, span, msg : & _ | lint_buffer. buffer_lint ( lint, node_id, span, msg) ;
0 commit comments