mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Tweak parse_asm_args
.
It doesn't need a `Parser` and a `ParseSess`, because the former contains the latter.
This commit is contained in:
parent
279c9ba260
commit
aa38c26bbf
@ -10,7 +10,6 @@ use rustc_index::bit_set::GrowableBitSet;
|
||||
use rustc_parse::parser::Parser;
|
||||
use rustc_parse_format as parse;
|
||||
use rustc_session::lint;
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::symbol::Ident;
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::{ErrorGuaranteed, InnerSpan, Span};
|
||||
@ -36,19 +35,17 @@ fn parse_args<'a>(
|
||||
is_global_asm: bool,
|
||||
) -> PResult<'a, AsmArgs> {
|
||||
let mut p = ecx.new_parser_from_tts(tts);
|
||||
let sess = &ecx.sess.parse_sess;
|
||||
parse_asm_args(&mut p, sess, sp, is_global_asm)
|
||||
parse_asm_args(&mut p, sp, is_global_asm)
|
||||
}
|
||||
|
||||
// Primarily public for rustfmt consumption.
|
||||
// Internal consumers should continue to leverage `expand_asm`/`expand__global_asm`
|
||||
pub fn parse_asm_args<'a>(
|
||||
p: &mut Parser<'a>,
|
||||
sess: &'a ParseSess,
|
||||
sp: Span,
|
||||
is_global_asm: bool,
|
||||
) -> PResult<'a, AsmArgs> {
|
||||
let dcx = &sess.dcx;
|
||||
let dcx = &p.sess.dcx;
|
||||
|
||||
if p.token == token::Eof {
|
||||
return Err(dcx.create_err(errors::AsmRequiresTemplate { span: sp }));
|
||||
|
@ -7,5 +7,5 @@ use crate::rewrite::RewriteContext;
|
||||
pub(crate) fn parse_asm(context: &RewriteContext<'_>, mac: &ast::MacCall) -> Option<AsmArgs> {
|
||||
let ts = mac.args.tokens.clone();
|
||||
let mut parser = super::build_parser(context, ts);
|
||||
parse_asm_args(&mut parser, context.parse_sess.inner(), mac.span(), false).ok()
|
||||
parse_asm_args(&mut parser, mac.span(), false).ok()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user