@@ -288,7 +288,8 @@ impl<'a> base::Resolver for Resolver<'a> {
288288
289289 // Derives are not included when `invocations` are collected, so we have to add them here.
290290 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) ?;
292293
293294 let span = invoc. span ( ) ;
294295 invoc_id. set_expn_data ( ext. expn_data (
@@ -338,6 +339,10 @@ impl<'a> base::Resolver for Resolver<'a> {
338339 }
339340 }
340341
342+ fn lint_node_id ( & mut self , expn_id : ExpnId ) -> NodeId {
343+ self . definitions . lint_node_id ( expn_id)
344+ }
345+
341346 fn has_derive_copy ( & self , expn_id : ExpnId ) -> bool {
342347 self . containers_deriving_copy . contains ( & expn_id)
343348 }
@@ -390,6 +395,7 @@ impl<'a> Resolver<'a> {
390395 path : & ast:: Path ,
391396 kind : MacroKind ,
392397 parent_scope : & ParentScope < ' a > ,
398+ node_id : NodeId ,
393399 force : bool ,
394400 ) -> Result < ( Lrc < SyntaxExtension > , Res ) , Indeterminate > {
395401 let ( ext, res) = match self . resolve_macro_path ( path, Some ( kind) , parent_scope, true , force)
@@ -430,7 +436,7 @@ impl<'a> Resolver<'a> {
430436 _ => panic ! ( "expected `DefKind::Macro` or `Res::NonMacroAttr`" ) ,
431437 } ;
432438
433- self . check_stability_and_deprecation ( & ext, path) ;
439+ self . check_stability_and_deprecation ( & ext, path, node_id ) ;
434440
435441 Ok ( if ext. macro_kind ( ) != kind {
436442 let expected = kind. descr_expected ( ) ;
@@ -984,13 +990,17 @@ impl<'a> Resolver<'a> {
984990 }
985991 }
986992
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+ ) {
988999 let span = path. span ;
9891000 if let Some ( stability) = & ext. stability {
9901001 if let StabilityLevel :: Unstable { reason, issue, is_soft } = stability. level {
9911002 let feature = stability. feature ;
9921003 if !self . active_features . contains ( & feature) && !span. allows_unstable ( feature) {
993- let node_id = ast:: CRATE_NODE_ID ;
9941004 let lint_buffer = & mut self . lint_buffer ;
9951005 let soft_handler =
9961006 |lint, span, msg : & _ | lint_buffer. buffer_lint ( lint, node_id, span, msg) ;
0 commit comments