Skip to content

Conversation

@lnicola
Copy link
Member

@lnicola lnicola commented Sep 18, 2025

Subtree update of rust-analyzer to rust-lang/rust-analyzer@15070dc.

Created using https://github.com/rust-lang/josh-sync.

r? @ghost

ChayimFriedman2 and others added 30 commits August 5, 2025 21:21
fix external docs for exported macros
fix: Do not remove the original token when descending into derives
Remove only contain literals dbg statement

```rust
fn foo() {
    let n = 2;
    $0dbg!(3);
    dbg!(2.6);
    dbg!(1, 2.5);
    dbg!('x');
    dbg!(&n);
    dbg!(n);
    // needless comment
    dbg!("foo");$0
}
```
->
```rust
fn foo() {
    // needless comment
}
```
Old:
```rust
fn foo() {
    3;
    2.6;
    (1, 2.5);
    'x';
    &n;
    n;
    // needless comment
    "foo";
}
```
…e-dbg

Add remove literal dbg stmt for remove_dbg
…lxvvyy

Report the incorrect payload when failing to deserialize lsp messages
…wpkmxw

Fix non-lsp compliant `Response` definition
Bumps [tmp](https://github.com/raszi/node-tmp) from 0.2.3 to 0.2.4.
- [Changelog](https://github.com/raszi/node-tmp/blob/master/CHANGELOG.md)
- [Commits](raszi/node-tmp@v0.2.3...v0.2.4)

---
updated-dependencies:
- dependency-name: tmp
  dependency-version: 0.2.4
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
…ast_instead_of_str

In handlers/extract_module.rs, generate ast::Module instead of String
…yarn/editors/code/tmp-0.2.4

Bump tmp from 0.2.3 to 0.2.4 in /editors/code
…qymsto

Disable error log for position clamping, its too noisy due to ease of triggering
remove duplicate field in Debug impl of ProjectWorkspace
…on_generate_by_indent_token

fix: generate function by indet token
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.
**Input**:

```rust
fn main() {
    write!(f, "{2+3}$0")
}
```

**Old output**:

```rust
fn main() {
    write!("{}"$0, 2+3)
}
```

**This PR output**:

```rust
fn main() {
    write!(f, "{}"$0, 2+3)
}
```
parser: fix parsing of trait bound polarity and for-binders
…m-fmtstr-on-write

Fix extract_expressions_from_format_string on write!
ChayimFriedman2 and others added 22 commits September 15, 2025 18:56
…iagnostics

This started from porting coercion, but ended with porting much more.
fix: More precise clause filtering for `explicit_*_predicates_of`
…pzus

fix: Only compute unstable paths on nightly toolchains for IDE features
…qxutsx

Add more workaround hacks for incorrect startup diagnostics
…vrts

fix: Fix expand macro recursively not working correctly for nested macro calls
Fix "sync-from-ra" for `rust-lang/rust`
…doc-breaks

fix(hover): unify horizontal rule formatting to `---`
Add `rust-analyzer.semanticHighlighting.comments.enable`
Enum variant fields do not allow visibility

Example
---
```rust
enum Foo {
    Variant($0String),
}
```

**Before this PR**:

```rust
enum Foo {
    Variant(pub(crate) String),
}
```

**After this PR**:

Assist not applicable
…cable-on-variant

Fix applicable on variant field for change_visibility
fix: Port a bunch of stuff from rustc and fix a bunch of type mismatches/diagnostics
@rustbot
Copy link
Collaborator

rustbot commented Sep 18, 2025

rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead.

cc @rust-lang/rust-analyzer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rust-analyzer Relevant to the rust-analyzer team, which will review and decide on the PR/issue. labels Sep 18, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 18, 2025

⚠️ Warning ⚠️

  • There are issue links (such as #123) in the commit messages of the following commits.
    Please move them to the PR description, to avoid spamming the issues with references to the commit, and so this bot can automatically canonicalize them to avoid issues with subtree.

  • This PR is based on an upstream commit that is older than 28 days.

    It's recommended to update your branch according to the rustc-dev-guide.

@rust-log-analyzer
Copy link
Collaborator

The job pr-check-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    Checking cargo-util-schemas v0.8.2
error[E0046]: not all trait items implemented, missing: `opaques_with_sub_unified_hidden_type`
  --> src/tools/rust-analyzer/crates/hir-ty/src/next_solver/infer/context.rs:18:1
   |
18 | impl<'db> rustc_type_ir::InferCtxtLike for InferCtxt<'db> {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `opaques_with_sub_unified_hidden_type` in implementation
   |
   = help: implement the missing item: `fn opaques_with_sub_unified_hidden_type(&self, _: TyVid) -> Vec<rustc_type_ir::AliasTy<<Self as InferCtxtLike>::Interner>> { todo!() }`

[RUSTC-TIMING] cargo_util_schemas test:false 1.116
    Checking cargo_metadata v0.21.0
error[E0164]: expected tuple struct or tuple variant, found struct variant `Certainty::Maybe`
   --> src/tools/rust-analyzer/crates/hir-ty/src/infer/unify.rs:913:20
    |
913 |             Ok((_, Certainty::Maybe(_))) => {
    |                    ^^^^^^^^^^^^^^^^^^^ not a tuple struct or tuple variant
    |
help: the struct variant's fields are being ignored
    |
913 -             Ok((_, Certainty::Maybe(_))) => {
913 +             Ok((_, Certainty::Maybe { cause: _, opaque_types_jank: _ })) => {
    |

[RUSTC-TIMING] icu_properties test:false 1.253
   Compiling typeid v1.0.3
    Checking mio v1.0.4
---
   Compiling pulldown-cmark v0.9.6
error[E0164]: expected tuple struct or tuple variant, found struct variant `Certainty::Maybe`
   --> src/tools/rust-analyzer/crates/hir-ty/src/next_solver/fulfill/errors.rs:156:44
    |
156 |             Ok(GoalEvaluation { certainty: Certainty::Maybe(MaybeCause::Ambiguity), .. }) => {
    |                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a tuple struct or tuple variant
    |
help: the struct variant's fields are being ignored
    |
156 -             Ok(GoalEvaluation { certainty: Certainty::Maybe(MaybeCause::Ambiguity), .. }) => {
156 +             Ok(GoalEvaluation { certainty: Certainty::Maybe { cause: _, opaque_types_jank: _ }, .. }) => {
    |

error[E0164]: expected tuple struct or tuple variant, found struct variant `Certainty::Maybe`
   --> src/tools/rust-analyzer/crates/hir-ty/src/next_solver/fulfill/errors.rs:161:21
    |
---
161 -                     Certainty::Maybe(MaybeCause::Overflow {
162 -                         suggest_increasing_limit,
163 -                         keep_constraints: _,
164 -                     }),
161 +                     Certainty::Maybe { cause: _, opaque_types_jank: _ },
    |

error[E0308]: mismatched types
   --> src/tools/rust-analyzer/crates/hir-ty/src/next_solver/fulfill/errors.rs:275:59
    |
275 |                 candidates.retain(|c| !matches!(c.kind(), inspect::ProbeKind::RigidAlias { .. }));
    |                                                 --------  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `ProbeKind<DbInterner<'_>>`, found `ProbeKind<_>`
    |                                                 |
    |                                                 this expression has type `rustc_type_ir::solve::inspect::ProbeKind<next_solver::interner::DbInterner<'_>>`
    |
    = note: `ProbeKind<_>` and `ProbeKind<DbInterner<'_>>` have similar names, but are actually distinct types
note: `ProbeKind<_>` is defined in crate `ra_ap_rustc_type_ir`
   --> /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ra-ap-rustc_type_ir-0.130.0/src/solve/inspect.rs:91:1
    |
 91 | pub enum ProbeKind<I: Interner> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: `ProbeKind<DbInterner<'_>>` is defined in crate `rustc_type_ir`
   --> /checkout/compiler/rustc_type_ir/src/solve/inspect.rs:91:1
    |
 91 | pub enum ProbeKind<I: Interner> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0164]: expected tuple struct or tuple variant, found struct variant `Certainty::Maybe`
   --> src/tools/rust-analyzer/crates/hir-ty/src/next_solver/fulfill/errors.rs:317:27
    |
317 |                 (true, Ok(Certainty::Maybe(MaybeCause::Ambiguity))) | (false, Err(_)) => {}
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a tuple struct or tuple variant
    |
help: the struct variant's fields are being ignored
    |
317 -                 (true, Ok(Certainty::Maybe(MaybeCause::Ambiguity))) | (false, Err(_)) => {}
317 +                 (true, Ok(Certainty::Maybe { cause: _, opaque_types_jank: _ })) | (false, Err(_)) => {}
    |

error[E0164]: expected tuple struct or tuple variant, found struct variant `Certainty::Maybe`
   --> src/tools/rust-analyzer/crates/hir-ty/src/next_solver/fulfill/errors.rs:459:23
    |
459 |             (true, Ok(Certainty::Maybe(MaybeCause::Ambiguity))) | (false, Err(_)) => {}
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a tuple struct or tuple variant
    |
help: the struct variant's fields are being ignored
    |
459 -             (true, Ok(Certainty::Maybe(MaybeCause::Ambiguity))) | (false, Err(_)) => {}
459 +             (true, Ok(Certainty::Maybe { cause: _, opaque_types_jank: _ })) | (false, Err(_)) => {}
    |

[RUSTC-TIMING] build_script_build test:false 0.096
    Checking notify-types v2.0.0
error[E0164]: expected tuple struct or tuple variant, found struct variant `Certainty::Maybe`
   --> src/tools/rust-analyzer/crates/hir-ty/src/next_solver/fulfill.rs:185:25
    |
185 |                         Certainty::Maybe(_) => {
    |                         ^^^^^^^^^^^^^^^^^^^ not a tuple struct or tuple variant
    |
help: the struct variant's fields are being ignored
    |
185 -                         Certainty::Maybe(_) => {
185 +                         Certainty::Maybe { cause: _, opaque_types_jank: _ } => {
    |

error[E0164]: expected tuple struct or tuple variant, found struct variant `Certainty::Maybe`
   --> src/tools/rust-analyzer/crates/hir-ty/src/next_solver/fulfill.rs:214:21
    |
214 |                     Certainty::Maybe(_) => self.obligations.register(obligation, stalled_on),
    |                     ^^^^^^^^^^^^^^^^^^^ not a tuple struct or tuple variant
    |
help: the struct variant's fields are being ignored
    |
214 -                     Certainty::Maybe(_) => self.obligations.register(obligation, stalled_on),
214 +                     Certainty::Maybe { cause: _, opaque_types_jank: _ } => self.obligations.register(obligation, stalled_on),
    |

[RUSTC-TIMING] notify_types test:false 0.102
    Checking notify v8.0.0
error[E0164]: expected tuple struct or tuple variant, found struct variant `Certainty::Maybe`
   --> src/tools/rust-analyzer/crates/hir-ty/src/next_solver/infer/select.rs:211:45
    |
211 |         if matches!(goal.result().unwrap(), Certainty::Maybe(..)) {
    |                                             ^^^^^^^^^^^^^^^^^^^^ not a tuple struct or tuple variant
    |
help: the struct variant's fields are being ignored
    |
211 -         if matches!(goal.result().unwrap(), Certainty::Maybe(..)) {
211 +         if matches!(goal.result().unwrap(), Certainty::Maybe { cause: _, opaque_types_jank: _ }) {
    |

error[E0164]: expected tuple struct or tuple variant, found struct variant `Certainty::Maybe`
   --> src/tools/rust-analyzer/crates/hir-ty/src/next_solver/infer/select.rs:244:42
    |
244 |     if matches!(other.result().unwrap(), Certainty::Maybe(..)) {
    |                                          ^^^^^^^^^^^^^^^^^^^^ not a tuple struct or tuple variant
    |
help: the struct variant's fields are being ignored
    |
244 -     if matches!(other.result().unwrap(), Certainty::Maybe(..)) {
244 +     if matches!(other.result().unwrap(), Certainty::Maybe { cause: _, opaque_types_jank: _ }) {
    |

error[E0164]: expected tuple struct or tuple variant, found struct variant `Certainty::Maybe`
   --> src/tools/rust-analyzer/crates/hir-ty/src/next_solver/infer/select.rs:287:12
    |
287 |     if let Certainty::Maybe(..) = cand.shallow_certainty() {
    |            ^^^^^^^^^^^^^^^^^^^^ not a tuple struct or tuple variant
    |
help: the struct variant's fields are being ignored
    |
287 -     if let Certainty::Maybe(..) = cand.shallow_certainty() {
287 +     if let Certainty::Maybe { cause: _, opaque_types_jank: _ } = cand.shallow_certainty() {
    |

error[E0164]: expected tuple struct or tuple variant, found struct variant `Certainty::Maybe`
   --> src/tools/rust-analyzer/crates/hir-ty/src/next_solver/infer/select.rs:293:9
    |
293 |         Certainty::Maybe(_) => cand
    |         ^^^^^^^^^^^^^^^^^^^ not a tuple struct or tuple variant
    |
help: the struct variant's fields are being ignored
    |
293 -         Certainty::Maybe(_) => cand
293 +         Certainty::Maybe { cause: _, opaque_types_jank: _ } => cand
    |

[RUSTC-TIMING] notify test:false 0.228
[RUSTC-TIMING] cargo_metadata test:false 0.965
[RUSTC-TIMING] typeid test:false 0.040
error[E0164]: expected tuple struct or tuple variant, found struct variant `Certainty::Maybe`
   --> src/tools/rust-analyzer/crates/hir-ty/src/next_solver/inspect.rs:353:37
    |
353 |                         None | Some(Certainty::Maybe(MaybeCause::Ambiguity))
    |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a tuple struct or tuple variant
    |
help: the struct variant's fields are being ignored
    |
353 -                         None | Some(Certainty::Maybe(MaybeCause::Ambiguity))
353 +                         None | Some(Certainty::Maybe { cause: _, opaque_types_jank: _ })
    |

[RUSTC-TIMING] idna_adapter test:false 0.066
error[E0063]: missing field `stable_hash` in initializer of `WithCachedTypeInfo<_>`
   --> src/tools/rust-analyzer/crates/hir-ty/src/next_solver/predicate.rs:226:22
---
[RUSTC-TIMING] form_urlencoded test:false 0.099
error[E0164]: expected tuple struct or tuple variant, found struct variant `Certainty::Maybe`
   --> src/tools/rust-analyzer/crates/hir-ty/src/traits.rs:280:16
    |
280 |         Ok((_, Certainty::Maybe(_), args)) => {
    |                ^^^^^^^^^^^^^^^^^^^ not a tuple struct or tuple variant
    |
help: the struct variant's fields are being ignored
    |
280 -         Ok((_, Certainty::Maybe(_), args)) => {
280 +         Ok((_, Certainty::Maybe { cause: _, opaque_types_jank: _ }, args)) => {
    |

error[E0164]: expected tuple struct or tuple variant, found struct variant `Certainty::Maybe`
   --> src/tools/rust-analyzer/crates/hir-ty/src/traits.rs:319:16
    |
319 |         Ok((_, Certainty::Maybe(_), args)) => {
    |                ^^^^^^^^^^^^^^^^^^^ not a tuple struct or tuple variant
    |
help: the struct variant's fields are being ignored
    |
319 -         Ok((_, Certainty::Maybe(_), args)) => {
319 +         Ok((_, Certainty::Maybe { cause: _, opaque_types_jank: _ }, args)) => {
    |

[RUSTC-TIMING] idna test:false 0.602
    Checking thiserror v1.0.69
[RUSTC-TIMING] thiserror test:false 0.036

@lnicola lnicola closed this Sep 18, 2025
@lnicola lnicola deleted the sync-from-ra branch September 18, 2025 18:51
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-rust-analyzer Relevant to the rust-analyzer team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.