]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_parse/lib.rs
Rollup merge of #69973 - tspiteri:const-int-conversion-since, r=dtolnay
[rust.git] / src / librustc_parse / lib.rs
index 25f9f8fd3ad4f076359896e5870be8b05f80e705..884499ff2dd48a5e9407f9b396e59c29dd5f8671 100644 (file)
@@ -2,9 +2,10 @@
 
 #![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;
@@ -171,8 +172,7 @@ fn maybe_source_file_to_parser(
     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)
@@ -271,11 +271,11 @@ pub fn stream_to_parser<'a>(
 /// 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)
 }