rust/src
Nathaniel McCallum 6b8a812aaf 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
..
bootstrap Rollup merge of #144470 - tgross35:clif-remove-no-f16-f128, r=bjorn3 2025-07-26 22:42:39 -04:00
build_helper integrate build_helper::npm into js checks and package.json usage 2025-07-19 14:56:42 -05:00
ci Rollup merge of #144454 - folkertdev:uefi-tests, r=jieyouxu 2025-07-27 10:19:02 +02:00
doc Rollup merge of #144435 - tshepang:rdg-sync, r=jieyouxu 2025-07-26 15:28:02 +02:00
etc update completions 2025-07-19 14:52:31 -05:00
gcc@04ce66d8c9 Update src/gcc submodule to 04ce66d8c918de9273bd7101638ad8724edf5e21 2025-05-14 18:02:02 +02:00
librustdoc Rollup merge of #144523 - ojeda:rustdoc-target-modifiers, r=GuillaumeGomez 2025-07-28 01:16:39 +02:00
llvm-project@e8a2ffcf32 Update LLVM submodule 2025-07-17 19:53:13 +08:00
rustc-std-workspace
rustdoc-json-types rustdoc-json: Structured attributes 2025-07-15 16:52:41 +00:00
tools parser: fix parsing of trait bound polarity and for-binders 2025-08-10 02:21:11 -04:00
README.md
stage0 Update stage0 to 1.89.0-beta.1 2025-07-01 10:54:33 -07:00
version Bump the version number to 1.90.0 2025-06-20 10:08:52 -07:00

This directory contains some source code for the Rust project, including:

  • The bootstrapping build system
  • Various submodules for tools, like cargo, tidy, etc.

For more information on how various parts of the compiler work, see the rustc dev guide.