Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/syntax/src/hacks.rs')
| -rw-r--r-- | crates/syntax/src/hacks.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/crates/syntax/src/hacks.rs b/crates/syntax/src/hacks.rs index a3023c3195..36615d11d8 100644 --- a/crates/syntax/src/hacks.rs +++ b/crates/syntax/src/hacks.rs @@ -2,11 +2,13 @@ //! //! Please avoid adding new usages of the functions in this module +use parser::Edition; + use crate::{ast, AstNode}; pub fn parse_expr_from_str(s: &str) -> Option<ast::Expr> { let s = s.trim(); - let file = ast::SourceFile::parse(&format!("const _: () = {s};")); + let file = ast::SourceFile::parse(&format!("const _: () = {s};"), Edition::CURRENT); let expr = file.syntax_node().descendants().find_map(ast::Expr::cast)?; if expr.syntax().text() != s { return None; |