about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGiga Bowser <45986823+Giga-Bowser@users.noreply.github.com>2024-12-14 16:08:22 -0500
committerGiga Bowser <45986823+Giga-Bowser@users.noreply.github.com>2025-01-06 15:32:08 -0600
commitbdb72bd405cee478f11ba4a720e0fb35423c14a2 (patch)
tree7a0ba293e9986d5b9e476cbe5fbef562070ce9e0
parent5afee0d54d7124af3042beee8dcbcce1b4df86e4 (diff)
downloadrust-bdb72bd405cee478f11ba4a720e0fb35423c14a2.tar.gz
rust-bdb72bd405cee478f11ba4a720e0fb35423c14a2.zip
internal: Generalize `make::expr_from_text` to types which implement `Into<ast::Expr>`
This will help with specializing the various `make::expr_*` functions later
-rw-r--r--src/tools/rust-analyzer/crates/syntax/src/ast/make.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/tools/rust-analyzer/crates/syntax/src/ast/make.rs b/src/tools/rust-analyzer/crates/syntax/src/ast/make.rs
index 282cbc4b3a4..0028fb93a5e 100644
--- a/src/tools/rust-analyzer/crates/syntax/src/ast/make.rs
+++ b/src/tools/rust-analyzer/crates/syntax/src/ast/make.rs
@@ -663,7 +663,7 @@ pub fn expr_tuple(elements: impl IntoIterator<Item = ast::Expr>) -> ast::Expr {
 pub fn expr_assignment(lhs: ast::Expr, rhs: ast::Expr) -> ast::Expr {
     expr_from_text(&format!("{lhs} = {rhs}"))
 }
-fn expr_from_text(text: &str) -> ast::Expr {
+fn expr_from_text<E: Into<ast::Expr> + AstNode>(text: &str) -> E {
     ast_from_text(&format!("const C: () = {text};"))
 }
 pub fn expr_let(pattern: ast::Pat, expr: ast::Expr) -> ast::LetExpr {