about summary refs log tree commit diff
path: root/src/tools/rust-analyzer/crates/parser
AgeCommit message (Collapse)AuthorLines
2025-08-18Auto-attach database in `Analysis` callsLukas Wirth-2/+1
2025-08-14feat: hint at unterminated strings in unknown prefix errorsRalf Anton Beier-1/+49
When encountering 'unknown literal prefix' errors, check for unbalanced quotes in recent code and suggest checking for unterminated string literals.
2025-08-13Merge Trait and TraitAlias handlingDeadbeef-6/+4
2025-08-10parser: fix parsing of trait bound polarity and for-bindersNathaniel McCallum-19/+73
The rustc AST allows both `for<>` binders and `?` polarity modifiers in trait bounds, but they are parsed in a specific order and validated for correctness: 1. `for<>` binder is parsed first. 2. Polarity modifiers (`?`, `!`) are parsed second. 3. The parser validates that binders and polarity modifiers do not conflict: ```rust if let Some(binder_span) = binder_span { match modifiers.polarity { BoundPolarity::Maybe(polarity_span) => { // Error: "for<...> binder not allowed with ? polarity" } } } ``` This implies: - `for<> ?Sized` → Valid syntax. Invalid semantics. - `?for<> Sized` → Invalid syntax. However, rust-analyzer incorrectly had special-case logic that allowed `?for<>` as valid syntax. This fix removes that incorrect special case, making rust-analyzer reject `?for<> Sized` as a syntax error, matching rustc behavior. This has caused confusion in other crates (such as syn) which rely on these files to implement correct syntax evaluation.
2025-07-31`cargo clippy --fix`Lukas Wirth-41/+38
2025-07-22Parse `for<'a> [const]`Chayim Refael Friedman-238/+360
And also refactor parsing of HRTB.
2025-07-15Format and bump rustc cratesLaurențiu Nicola-2/+2
2025-07-15Merge from rust-lang/rustLaurențiu Nicola-4/+6
2025-07-10Merge pull request #20210 from ChayimFriedman2/naked-asm-safeShoyu Vanilla (Flint)-9/+106
fix: Inline asm fixes
2025-07-09feat(lexer): Allow including frontmatter with 'tokenize'Ed Page-4/+6
2025-07-09Make `global_asm!()` workChayim Refael Friedman-12/+37
Because apparently, we were not accepting inline asm in item position, completely breaking it.
2025-07-09Differentiate between `asm!()`, `global_asm!()` and `naked_asm!()`, and make ↵Chayim Refael Friedman-7/+79
only `asm!()` unsafe
2025-07-06Always bump in the parser in `err_and_bump()`Chayim Refael Friedman-5/+9
Even when at curly braces, otherwise the parser can get stuck. This has happened in the past in #18625, but it was just worked around instead of handling the root of the problem. Now this happened again in #20171. IMO we can't let `err_and_bump()` not bump, that's too confusing and invites errors. We can (as I did) workaround the worse recovery instead.
2025-06-26Parse new const trait syntaxLukas Wirth-3/+9
2025-06-24Merge pull request #20012 from lnicola/bump-literal-escaperLukas Wirth-71/+60
Update to literal-escaper 0.0.4
2025-06-23Don't run doctestsChayim Refael Friedman-0/+1
2025-06-16update to literal-escaper 0.0.4 for better API without `unreachable` and ↵Marijn Schouten-71/+60
faster string parsing
2025-06-05Better parser recovery for macro calls in type bound positionLukas Wirth-10/+134
2025-06-04Give path segment type anchors their own grammar ruleLukas Wirth-129/+145
2025-05-30Update expected test outputArthur Baars-21/+60
2025-05-30Run 'cargo codegen' to update testsArthur Baars-0/+5
2025-05-30Add test for closure_binderArthur Baars-0/+2
Co-authored-by: Lukas Wirth <me@lukaswirth.dev>
2025-05-30Produce ClosureBinder node in atom.rsArthur Baars-0/+2
2025-05-20Bump rustc cratesLaurențiu Nicola-1/+4
2025-05-20Merge from rust-lang/rustLaurențiu Nicola-1/+12
2025-05-15Improve asm supportChayim Refael Friedman-2/+48
Including: - Infer `label {}` and `const` operands. - Correctly handle unsafe check inside `label {}`. - Fix an embarrassing parser typo that cause labels to never be part of the AST
2025-05-06Rollup merge of #140035 - fee1-dead-contrib:push-oszwkkvmpkks, ↵Stuart Cook-1/+12
r=jieyouxu,wesleywiser Implement RFC 3503: frontmatters Tracking issue: #136889 Supercedes #137193. This implements [RFC 3503](https://github.com/rust-lang/rfcs/blob/master/text/3503-frontmatter.md). This might break rust-analyzer. Will look into how to fix that. Suggestions welcome for how to improve diagnostics.
2025-05-05Implement RFC 3503: frontmattersDeadbeef-1/+12
Supercedes #137193
2025-04-30fix: Improve parser recovery a bitLukas Wirth-14/+84
2025-04-28Format codeLaurențiu Nicola-1/+3
2025-04-28Merge from rust-lang/rustLaurențiu Nicola-5/+6
2025-04-25Preallocate `parser::Input`Chayim Refael Friedman-2/+9
2025-04-22Merge pull request #19657 from ChayimFriedman2/better-offset-ofLukas Wirth-0/+61
feat: Better support `offset_of!()`
2025-04-21Merge pull request #19643 from ChayimFriedman2/generic-const-itemsLukas Wirth-0/+296
feat: Parse generic consts
2025-04-21feat: parse `super let`Lukas Wirth-3/+27
2025-04-21Allow wrapping `builtin#offset_of` fields argument in parenthesesChayim Refael Friedman-0/+61
This is necessary to correctly handle nested fields (`foo.bar`), see the comments in the code for explanation.
2025-04-21Parse generic constsChayim Refael Friedman-0/+296
A lang team experiment, https://github.com/rust-lang/rust/issues/113521.
2025-04-05Clean up `rustc-literal-escaper` usage in rust-analyzerGuillaume Gomez-1/+1
2025-04-04Update `rustc-literal-escaper` version to `0.0.2`Guillaume Gomez-1/+1
2025-04-04Remove usage of `rustc_lexer::unescape` in rust-analyzerGuillaume Gomez-5/+6
2025-03-25feat: parse `unsafe` record fieldsLukas Wirth-2/+17
2025-03-23chore: Bump dependenciesLukas Wirth-1/+1
2025-03-21fix: Fix incorrect expansion of builtin `PartialOrd` deriveLukas Wirth-0/+1
2025-03-21refactor: Reduce codegen burden for `SyntaxNode` and `SyntaxToken`Lukas Wirth-1/+1
2025-03-21refactor: Reduce codegen burden for `SyntaxKind`Lukas Wirth-32/+29
2025-03-17chore: Bump `Edition::CURRENT` to 2024Lukas Wirth-5/+13
2025-03-15cargo fmtBenjaminBrienen-7/+7
2025-03-08fix(hir): `VariantDef` is `impl HasSource`Prajwal S N-0/+2
A new syntax node `ast::VariantDef` has been introduced to map between the HIR node and the AST. The files have been updated with `cargo test -p xtask`. Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2025-03-01Cleanup string handling in syntax highlightingLukas Wirth-18/+1
2025-02-27fix doc testsBenjaminBrienen-4/+5