mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 07:44:10 +00:00
parser/expand: minor cleanup
This commit is contained in:
parent
a6cb04ff23
commit
7d0e5bbb67
@ -258,7 +258,7 @@ fn generic_extension<'cx>(
|
||||
trace_macros_note(&mut cx.expansions, sp, msg);
|
||||
}
|
||||
|
||||
let mut p = Parser::new(cx.parse_sess(), tts, false, None);
|
||||
let mut p = Parser::new(sess, tts, false, None);
|
||||
p.root_module_name =
|
||||
cx.current_expansion.module.mod_path.last().map(|id| id.to_string());
|
||||
p.last_type_ascription = cx.current_expansion.prior_type_ascription;
|
||||
@ -1204,7 +1204,7 @@ fn quoted_tt_to_string(tt: &mbe::TokenTree) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
fn parser_from_cx<'cx>(sess: &'cx ParseSess, tts: TokenStream) -> Parser<'cx> {
|
||||
fn parser_from_cx(sess: &ParseSess, tts: TokenStream) -> Parser<'_> {
|
||||
Parser::new(sess, tts, true, rustc_parse::MACRO_ARGUMENTS)
|
||||
}
|
||||
|
||||
|
@ -238,21 +238,6 @@ pub fn stream_to_parser<'a>(
|
||||
Parser::new(sess, stream, false, subparser_name)
|
||||
}
|
||||
|
||||
/// Given a stream, the `ParseSess` and the base directory, produces a parser.
|
||||
///
|
||||
/// Use this function when you are creating a parser from the token stream
|
||||
/// and also care about the current working directory of the parser (e.g.,
|
||||
/// you are trying to resolve modules defined inside a macro invocation).
|
||||
///
|
||||
/// # Note
|
||||
///
|
||||
/// The main usage of this function is outside of rustc, for those who uses
|
||||
/// librustc_ast as a library. Please do not remove this function while refactoring
|
||||
/// just because it is not used in rustc codebase!
|
||||
pub fn stream_to_parser_with_base_dir(sess: &ParseSess, stream: TokenStream) -> Parser<'_> {
|
||||
Parser::new(sess, stream, false, None)
|
||||
}
|
||||
|
||||
/// Runs the given subparser `f` on the tokens of the given `attr`'s item.
|
||||
pub fn parse_in<'a, T>(
|
||||
sess: &'a ParseSess,
|
||||
|
Loading…
Reference in New Issue
Block a user