Skip to content

Commit aa38c26

Browse files
committed
Tweak parse_asm_args.
It doesn't need a `Parser` and a `ParseSess`, because the former contains the latter.
1 parent 279c9ba commit aa38c26

File tree

2 files changed

+3
-6
lines changed
  • compiler/rustc_builtin_macros/src
  • src/tools/rustfmt/src/parse/macros

2 files changed

+3
-6
lines changed

compiler/rustc_builtin_macros/src/asm.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use rustc_index::bit_set::GrowableBitSet;
1010
use rustc_parse::parser::Parser;
1111
use rustc_parse_format as parse;
1212
use rustc_session::lint;
13-
use rustc_session::parse::ParseSess;
1413
use rustc_span::symbol::Ident;
1514
use rustc_span::symbol::{kw, sym, Symbol};
1615
use rustc_span::{ErrorGuaranteed, InnerSpan, Span};
@@ -36,19 +35,17 @@ fn parse_args<'a>(
3635
is_global_asm: bool,
3736
) -> PResult<'a, AsmArgs> {
3837
let mut p = ecx.new_parser_from_tts(tts);
39-
let sess = &ecx.sess.parse_sess;
40-
parse_asm_args(&mut p, sess, sp, is_global_asm)
38+
parse_asm_args(&mut p, sp, is_global_asm)
4139
}
4240

4341
// Primarily public for rustfmt consumption.
4442
// Internal consumers should continue to leverage `expand_asm`/`expand__global_asm`
4543
pub fn parse_asm_args<'a>(
4644
p: &mut Parser<'a>,
47-
sess: &'a ParseSess,
4845
sp: Span,
4946
is_global_asm: bool,
5047
) -> PResult<'a, AsmArgs> {
51-
let dcx = &sess.dcx;
48+
let dcx = &p.sess.dcx;
5249

5350
if p.token == token::Eof {
5451
return Err(dcx.create_err(errors::AsmRequiresTemplate { span: sp }));

src/tools/rustfmt/src/parse/macros/asm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ use crate::rewrite::RewriteContext;
77
pub(crate) fn parse_asm(context: &RewriteContext<'_>, mac: &ast::MacCall) -> Option<AsmArgs> {
88
let ts = mac.args.tokens.clone();
99
let mut parser = super::build_parser(context, ts);
10-
parse_asm_args(&mut parser, context.parse_sess.inner(), mac.span(), false).ok()
10+
parse_asm_args(&mut parser, mac.span(), false).ok()
1111
}

0 commit comments

Comments
 (0)