#![feature(bool_to_option)]
#![feature(crate_visibility_modifier)]
+#![feature(bindings_after_at)]
use rustc_ast::ast;
-use rustc_ast::token::{self, Nonterminal, Token};
+use rustc_ast::token::{self, Nonterminal};
use rustc_ast::tokenstream::{self, TokenStream, TokenTree};
use rustc_ast_pretty::pprust;
use rustc_data_structures::sync::Lrc;
let mut parser = stream_to_parser(sess, stream, None);
parser.unclosed_delims = unclosed_delims;
if parser.token == token::Eof {
- let span = Span::new(end_pos, end_pos, parser.token.span.ctxt());
- parser.set_token(Token::new(token::Eof, span));
+ parser.token.span = Span::new(end_pos, end_pos, parser.token.span.ctxt());
}
Ok(parser)
/// 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<'a>(
- sess: &'a ParseSess,
+pub fn stream_to_parser_with_base_dir(
+ sess: &ParseSess,
stream: TokenStream,
base_dir: Directory,
-) -> Parser<'a> {
+) -> Parser<'_> {
Parser::new(sess, stream, Some(base_dir), true, false, None)
}