Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/syntax/src/lib.rs')
-rw-r--r--crates/syntax/src/lib.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/crates/syntax/src/lib.rs b/crates/syntax/src/lib.rs
index 41f560fce2..1c628a948c 100644
--- a/crates/syntax/src/lib.rs
+++ b/crates/syntax/src/lib.rs
@@ -172,7 +172,7 @@ pub use crate::ast::SourceFile;
impl SourceFile {
pub fn parse(text: &str) -> Parse<SourceFile> {
let _p = tracing::span!(tracing::Level::INFO, "SourceFile::parse").entered();
- let (green, errors) = parsing::parse_text(text);
+ let (green, errors) = parsing::parse_text(text, parser::Edition::Edition2021);
let root = SyntaxNode::new_root(green.clone());
assert_eq!(root.kind(), SyntaxKind::SOURCE_FILE);
@@ -185,7 +185,10 @@ impl SourceFile {
}
impl ast::TokenTree {
- pub fn reparse_as_comma_separated_expr(self) -> Parse<ast::MacroEagerInput> {
+ pub fn reparse_as_comma_separated_expr(
+ self,
+ edition: parser::Edition,
+ ) -> Parse<ast::MacroEagerInput> {
let tokens = self.syntax().descendants_with_tokens().filter_map(NodeOrToken::into_token);
let mut parser_input = parser::Input::default();
@@ -219,8 +222,7 @@ impl ast::TokenTree {
}
}
- let parser_output = parser::TopEntryPoint::MacroEagerInput
- .parse(&parser_input, parser::Edition::Edition2021);
+ let parser_output = parser::TopEntryPoint::MacroEagerInput.parse(&parser_input, edition);
let mut tokens =
self.syntax().descendants_with_tokens().filter_map(NodeOrToken::into_token);