rust-analyzer/crates
Nathaniel McCallum 943b42f743 parser: fix parsing of trait bound polarity and for-binders
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-08-10 02:21:11 -04:00
..
base-db When renaming a parameter to self, change callers to use method call syntax 2025-08-02 21:39:22 +03:00
cfg cargo clippy --fix 2025-07-31 10:55:10 +02:00
edition chore: Bump Edition::CURRENT to 2024 2025-03-17 12:29:19 +01:00
hir Do not remove the original token when descending into derives 2025-08-05 01:04:21 +03:00
hir-def cargo clippy --fix 2025-07-31 10:55:10 +02:00
hir-expand When renaming a parameter to self, change callers to use method call syntax 2025-08-02 21:39:22 +03:00
hir-ty When renaming a parameter to self, change callers to use method call syntax 2025-08-02 21:39:22 +03:00
ide Merge pull request #20392 from rust-lang/veykril/push-pxplxplxvvyy 2025-08-06 15:42:24 +00:00
ide-assists fix: generate function by indet token 2025-08-09 15:48:10 +09:00
ide-completion Merge pull request #20381 from A4-Tacks/fix-assign-sug 2025-08-05 15:17:49 +00:00
ide-db remvoe add_attr edit_in_place.rs because it use ted. 2025-08-04 21:52:49 +09:00
ide-diagnostics When renaming a parameter to self, change callers to use method call syntax 2025-08-02 21:39:22 +03:00
ide-ssr When renaming a parameter to self, change callers to use method call syntax 2025-08-02 21:39:22 +03:00
intern Support cfg_select! 2025-07-20 11:56:45 +03:00
load-cargo cargo clippy --fix 2025-07-31 10:55:10 +02:00
mbe cargo clippy --fix 2025-07-31 10:55:10 +02:00
parser parser: fix parsing of trait bound polarity and for-binders 2025-08-10 02:21:11 -04:00
paths Don't run doctests 2025-06-23 00:50:22 +03:00
proc-macro-api Add version command to proc-macro-srv 2025-07-31 10:10:50 +02:00
proc-macro-srv Reorganize proc-macro-srv 2025-07-31 09:55:07 +02:00
proc-macro-srv-cli Add version command to proc-macro-srv 2025-07-31 10:10:50 +02:00
profile Don't run doctests 2025-06-23 00:50:22 +03:00
project-model remove duplicate field in Debug 2025-08-08 23:46:28 +02:00
query-group-macro cargo clippy --fix 2025-07-31 10:55:10 +02:00
rust-analyzer Merge pull request #20400 from rust-lang/veykril/push-ksxzmxqymsto 2025-08-07 13:25:13 +00:00
span cargo clippy --fix 2025-07-31 10:55:10 +02:00
stdx Don't run doctests 2025-06-23 00:50:22 +03:00
syntax In extract_module.rs, generate ast::Module instead of String 2025-08-07 02:29:59 +09:00
syntax-bridge cargo clippy --fix 2025-07-31 10:55:10 +02:00
test-fixture cargo clippy --fix 2025-07-31 10:55:10 +02:00
test-utils Add write! and writeln! to minicore 2025-08-09 00:09:56 +08:00
toolchain Don't run doctests 2025-06-23 00:50:22 +03:00
tt cargo clippy --fix 2025-07-31 10:55:10 +02:00
vfs Bump salsa 2025-07-03 10:05:16 +02:00
vfs-notify cargo clippy --fix 2025-07-31 10:55:10 +02:00