@@ -18,7 +18,7 @@ use rustc_data_structures::fx::FxHashMap;
18
18
use rustc_data_structures:: sync:: Lrc ;
19
19
use rustc_errors:: { Applicability , DiagnosticBuilder } ;
20
20
use rustc_feature:: Features ;
21
- use rustc_lint_defs:: builtin:: MACRO_TRAILING_SEMICOLON ;
21
+ use rustc_lint_defs:: builtin:: SEMICOLON_IN_EXPRESSIONS_FROM_MACROS ;
22
22
use rustc_parse:: parser:: Parser ;
23
23
use rustc_session:: parse:: ParseSess ;
24
24
use rustc_session:: Session ;
@@ -39,7 +39,7 @@ crate struct ParserAnyMacro<'a> {
39
39
site_span : Span ,
40
40
/// The ident of the macro we're parsing
41
41
macro_ident : Ident ,
42
- nearest_parent : NodeId ,
42
+ lint_node_id : NodeId ,
43
43
arm_span : Span ,
44
44
}
45
45
@@ -113,7 +113,7 @@ fn emit_frag_parse_err(
113
113
114
114
impl < ' a > ParserAnyMacro < ' a > {
115
115
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 } =
117
117
* self ;
118
118
let snapshot = & mut parser. clone ( ) ;
119
119
let fragment = match parse_ast_fragment ( parser, kind) {
@@ -129,9 +129,9 @@ impl<'a> ParserAnyMacro<'a> {
129
129
// but `m!()` is allowed in expression positions (cf. issue #34706).
130
130
if kind == AstFragmentKind :: Expr && parser. token == token:: Semi {
131
131
parser. sess . buffer_lint (
132
- MACRO_TRAILING_SEMICOLON ,
132
+ SEMICOLON_IN_EXPRESSIONS_FROM_MACROS ,
133
133
parser. token . span ,
134
- nearest_parent ,
134
+ lint_node_id ,
135
135
"trailing semicolon in macro used in expression position" ,
136
136
) ;
137
137
parser. bump ( ) ;
@@ -159,7 +159,6 @@ impl TTMacroExpander for MacroRulesMacroExpander {
159
159
cx : & ' cx mut ExtCtxt < ' _ > ,
160
160
sp : Span ,
161
161
input : TokenStream ,
162
- nearest_parent : NodeId ,
163
162
) -> Box < dyn MacResult + ' cx > {
164
163
if !self . valid {
165
164
return DummyResult :: any ( sp) ;
@@ -171,7 +170,6 @@ impl TTMacroExpander for MacroRulesMacroExpander {
171
170
self . name ,
172
171
self . transparency ,
173
172
input,
174
- nearest_parent,
175
173
& self . lhses ,
176
174
& self . rhses ,
177
175
)
@@ -199,7 +197,6 @@ fn generic_extension<'cx>(
199
197
name : Ident ,
200
198
transparency : Transparency ,
201
199
arg : TokenStream ,
202
- nearest_parent : NodeId ,
203
200
lhses : & [ mbe:: TokenTree ] ,
204
201
rhses : & [ mbe:: TokenTree ] ,
205
202
) -> Box < dyn MacResult + ' cx > {
@@ -289,6 +286,7 @@ fn generic_extension<'cx>(
289
286
290
287
let mut p = Parser :: new ( sess, tts, false , None ) ;
291
288
p. last_type_ascription = cx. current_expansion . prior_type_ascription ;
289
+ let lint_node_id = cx. resolver . lint_node_id ( cx. current_expansion . id ) ;
292
290
293
291
// Let the context choose how to interpret the result.
294
292
// Weird, but useful for X-macros.
@@ -300,7 +298,7 @@ fn generic_extension<'cx>(
300
298
// macro leaves unparsed tokens.
301
299
site_span : sp,
302
300
macro_ident : name,
303
- nearest_parent ,
301
+ lint_node_id ,
304
302
arm_span,
305
303
} ) ;
306
304
}
0 commit comments