diff options
Diffstat (limited to 'crates/syntax')
-rw-r--r-- | crates/syntax/Cargo.toml | 2 | ||||
-rw-r--r-- | crates/syntax/src/ast/make.rs | 8 |
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 | |||
14 | cov-mark = { version = "1.1", features = ["thread-local"] } | 14 | cov-mark = { version = "1.1", features = ["thread-local"] } |
15 | itertools = "0.10.0" | 15 | itertools = "0.10.0" |
16 | rowan = "=0.13.0-pre.3" | 16 | rowan = "=0.13.0-pre.3" |
17 | rustc_lexer = { version = "714.0.0", package = "rustc-ap-rustc_lexer" } | 17 | rustc_lexer = { version = "716.0.0", package = "rustc-ap-rustc_lexer" } |
18 | rustc-hash = "1.1.0" | 18 | rustc-hash = "1.1.0" |
19 | arrayvec = "0.7" | 19 | arrayvec = "0.7" |
20 | once_cell = "1.3.1" | 20 | once_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 | ||
297 | pub 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 |