diff options
| author | Laurențiu Nicola <lnicola@dend.ro> | 2024-03-03 09:17:31 +0200 |
|---|---|---|
| committer | Laurențiu Nicola <lnicola@dend.ro> | 2024-03-03 09:17:31 +0200 |
| commit | 964e769ffd5df865780e098380a9a4a99360e50b (patch) | |
| tree | 1ae4054e69d582516ac31f446d05ddc1123ba407 /src/tools/rust-analyzer/crates/syntax | |
| parent | 3793e5ba23ca6a57ace8e3e267c22001cc5ef794 (diff) | |
| parent | 4ef6a49b44e8aa380da7522442234bfd7a52c55e (diff) | |
Merge commit '4ef6a49b44e8aa380da7522442234bfd7a52c55e' into sync-from-ra
Diffstat (limited to 'src/tools/rust-analyzer/crates/syntax')
| -rw-r--r-- | src/tools/rust-analyzer/crates/syntax/fuzz/Cargo.toml | 4 | ||||
| -rw-r--r-- | src/tools/rust-analyzer/crates/syntax/src/ast/make.rs | 10 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/tools/rust-analyzer/crates/syntax/fuzz/Cargo.toml b/src/tools/rust-analyzer/crates/syntax/fuzz/Cargo.toml index ebf538aa247..a235e3e17ce 100644 --- a/src/tools/rust-analyzer/crates/syntax/fuzz/Cargo.toml +++ b/src/tools/rust-analyzer/crates/syntax/fuzz/Cargo.toml @@ -3,7 +3,7 @@ name = "syntax-fuzz" version = "0.0.1" publish = false edition = "2021" -rust-version = "1.66.1" +rust-version = "1.76" [package.metadata] cargo-fuzz = true @@ -26,4 +26,4 @@ name = "reparse" path = "fuzz_targets/reparse.rs" [lints] -workspace = true \ No newline at end of file +workspace = true 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 02246fc3291..f299dda4f0f 100644 --- a/src/tools/rust-analyzer/crates/syntax/src/ast/make.rs +++ b/src/tools/rust-analyzer/crates/syntax/src/ast/make.rs @@ -656,6 +656,10 @@ pub fn wildcard_pat() -> ast::WildcardPat { } } +pub fn rest_pat() -> ast::RestPat { + ast_from_text("fn f(..)") +} + pub fn literal_pat(lit: &str) -> ast::LiteralPat { return from_text(lit); @@ -716,8 +720,12 @@ pub fn record_pat_with_fields(path: ast::Path, fields: ast::RecordPatFieldList) pub fn record_pat_field_list( fields: impl IntoIterator<Item = ast::RecordPatField>, + rest_pat: Option<ast::RestPat>, ) -> ast::RecordPatFieldList { - let fields = fields.into_iter().join(", "); + let mut fields = fields.into_iter().join(", "); + if let Some(rest_pat) = rest_pat { + format_to!(fields, ", {rest_pat}"); + } ast_from_text(&format!("fn f(S {{ {fields} }}: ()))")) } |
