@@ -18,7 +18,7 @@ use rustc_data_structures::fx::FxHashMap;
1818use rustc_data_structures:: sync:: Lrc ;
1919use rustc_errors:: { Applicability , DiagnosticBuilder } ;
2020use rustc_feature:: Features ;
21- use rustc_lint_defs:: builtin:: MACRO_TRAILING_SEMICOLON ;
21+ use rustc_lint_defs:: builtin:: SEMICOLON_IN_EXPRESSIONS_FROM_MACROS ;
2222use rustc_parse:: parser:: Parser ;
2323use rustc_session:: parse:: ParseSess ;
2424use rustc_session:: Session ;
@@ -39,7 +39,7 @@ crate struct ParserAnyMacro<'a> {
3939 site_span : Span ,
4040 /// The ident of the macro we're parsing
4141 macro_ident : Ident ,
42- nearest_parent : NodeId ,
42+ lint_node_id : NodeId ,
4343 arm_span : Span ,
4444}
4545
@@ -113,7 +113,7 @@ fn emit_frag_parse_err(
113113
114114impl < ' a > ParserAnyMacro < ' a > {
115115 crate fn make ( mut self : Box < ParserAnyMacro < ' a > > , kind : AstFragmentKind ) -> AstFragment {
116- let ParserAnyMacro { site_span, macro_ident, ref mut parser, nearest_parent , arm_span } =
116+ let ParserAnyMacro { site_span, macro_ident, ref mut parser, lint_node_id , arm_span } =
117117 * self ;
118118 let snapshot = & mut parser. clone ( ) ;
119119 let fragment = match parse_ast_fragment ( parser, kind) {
@@ -129,9 +129,9 @@ impl<'a> ParserAnyMacro<'a> {
129129 // but `m!()` is allowed in expression positions (cf. issue #34706).
130130 if kind == AstFragmentKind :: Expr && parser. token == token:: Semi {
131131 parser. sess . buffer_lint (
132- MACRO_TRAILING_SEMICOLON ,
132+ SEMICOLON_IN_EXPRESSIONS_FROM_MACROS ,
133133 parser. token . span ,
134- nearest_parent ,
134+ lint_node_id ,
135135 "trailing semicolon in macro used in expression position" ,
136136 ) ;
137137 parser. bump ( ) ;
@@ -159,7 +159,6 @@ impl TTMacroExpander for MacroRulesMacroExpander {
159159 cx : & ' cx mut ExtCtxt < ' _ > ,
160160 sp : Span ,
161161 input : TokenStream ,
162- nearest_parent : NodeId ,
163162 ) -> Box < dyn MacResult + ' cx > {
164163 if !self . valid {
165164 return DummyResult :: any ( sp) ;
@@ -171,7 +170,6 @@ impl TTMacroExpander for MacroRulesMacroExpander {
171170 self . name ,
172171 self . transparency ,
173172 input,
174- nearest_parent,
175173 & self . lhses ,
176174 & self . rhses ,
177175 )
@@ -199,7 +197,6 @@ fn generic_extension<'cx>(
199197 name : Ident ,
200198 transparency : Transparency ,
201199 arg : TokenStream ,
202- nearest_parent : NodeId ,
203200 lhses : & [ mbe:: TokenTree ] ,
204201 rhses : & [ mbe:: TokenTree ] ,
205202) -> Box < dyn MacResult + ' cx > {
@@ -289,6 +286,7 @@ fn generic_extension<'cx>(
289286
290287 let mut p = Parser :: new ( sess, tts, false , None ) ;
291288 p. last_type_ascription = cx. current_expansion . prior_type_ascription ;
289+ let lint_node_id = cx. resolver . lint_node_id ( cx. current_expansion . id ) ;
292290
293291 // Let the context choose how to interpret the result.
294292 // Weird, but useful for X-macros.
@@ -300,7 +298,7 @@ fn generic_extension<'cx>(
300298 // macro leaves unparsed tokens.
301299 site_span : sp,
302300 macro_ident : name,
303- nearest_parent ,
301+ lint_node_id ,
304302 arm_span,
305303 } ) ;
306304 }
0 commit comments