aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax
diff options
context:
space:
mode:
Diffstat (limited to 'crates/syntax')
-rw-r--r--crates/syntax/Cargo.toml2
-rw-r--r--crates/syntax/src/ast/make.rs8
2 files changed, 9 insertions, 1 deletions
diff --git a/crates/syntax/Cargo.toml b/crates/syntax/Cargo.toml
index a8c1a8075..556f80882 100644
--- a/crates/syntax/Cargo.toml
+++ b/crates/syntax/Cargo.toml
@@ -14,7 +14,7 @@ doctest = false
14cov-mark = { version = "1.1", features = ["thread-local"] } 14cov-mark = { version = "1.1", features = ["thread-local"] }
15itertools = "0.10.0" 15itertools = "0.10.0"
16rowan = "=0.13.0-pre.3" 16rowan = "=0.13.0-pre.3"
17rustc_lexer = { version = "714.0.0", package = "rustc-ap-rustc_lexer" } 17rustc_lexer = { version = "716.0.0", package = "rustc-ap-rustc_lexer" }
18rustc-hash = "1.1.0" 18rustc-hash = "1.1.0"
19arrayvec = "0.7" 19arrayvec = "0.7"
20once_cell = "1.3.1" 20once_cell = "1.3.1"
diff --git a/crates/syntax/src/ast/make.rs b/crates/syntax/src/ast/make.rs
index 94d4f2cf0..4cf6f871e 100644
--- a/crates/syntax/src/ast/make.rs
+++ b/crates/syntax/src/ast/make.rs
@@ -294,6 +294,14 @@ pub fn wildcard_pat() -> ast::WildcardPat {
294 } 294 }
295} 295}
296 296
297pub fn literal_pat(lit: &str) -> ast::LiteralPat {
298 return from_text(lit);
299
300 fn from_text(text: &str) -> ast::LiteralPat {
301 ast_from_text(&format!("fn f() {{ match x {{ {} => {{}} }} }}", text))
302 }
303}
304
297/// Creates a tuple of patterns from an iterator of patterns. 305/// Creates a tuple of patterns from an iterator of patterns.
298/// 306///
299/// Invariant: `pats` must be length > 0 307/// Invariant: `pats` must be length > 0