Skip to content

Rollup of 9 pull requests - #164211

Closed
JonathanBrouwer wants to merge 211 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-8cGZy0S
Closed

JonathanBrouwer wants to merge 211 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-8cGZy0S

Conversation

@JonathanBrouwer

Copy link
Copy Markdown
Member

Successful merges:

r? @ghost

Create a similar rollup

RalfJung and others added 30 commits September 2, 2026 15:47
This also closes gaps we had, e.g. now `check_impl()` will include field defaults.

The only changes to tests are some ordering changes due to sorting by the root expr's location now instead of the full item's location, and removal of trait functions without bodies, since they don't have a root expr. As their inference is meaningless (only the parameter types, unless you have anon consts in the parameters' patterns which we don't have in our tests), I felt safe to ignore that.
Instead store `Option`s for the self-referential parts.
…n_args_for_alias()`

It's not an optimization yet, but in the in-tree solver this function reuses the `GenericArgs` if the assoc has no args of its own.
And since `Projection::project()` does not require `DbInterner`, also remove this requirement from any slice's `new_from_iter()`, which is probably better anyway.
Again for the intent of making `AnonConst` a tracked struct (as well as for perf).

We still have one problematic query: `resolve_type_param_assoc_type_shorthand()`. It is problematic and I need to think what to do with it.
E.g.:
```rust
trait Trait
where
    Self::Assoc: OtherTrait,
{
    type Assoc;
}
```
Is equivalent to:
```rust
trait Trait {
    type Assoc: OtherTrait;
}
```

The code was copied from rustc and adapted.
Signed-off-by: 0xull <mrikehchukwuka@gmail.com>
fix: cache macro-expanded roots when climbing ancestors
…-refactor

internal: Refactor `SyntaxContext` to not reimplement Salsa macros
If the discover command failed, log which directory we tried to run it
in. This is really helpful when users have a bunch of worktrees.
This package is deprecated (producing npm warnings) and its GitHub
repository has been archived.

We can just use eslint Config types directly these days, so do that instead.

AI disclosure: Code partly written by GPT-5.6 Sol, commit message and
review by me.
…ine-config

internal: Remove deprecated eslint-define-config dependency
fix: Include working directory when discover command fails
Example
---
```rust
trait Trait { fn method(); }
impl Trait for Foo { fn method() {} }
struct Foo;

fn main() {
    Foo::$0method()
}
```

**Before this PR**

```rust
fn method()
```

**After this PR**

```rust
impl Trait for Foo
fn method()
```
rust-analyzer would panic when the trait solver called itself, which
can happen during const evaluation.

rustc has the same function, but doesn't panic, so just copy the rustc
implementation:

https://github.com/rust-lang/rust/blob/5392d2f545c6836dc79f209bcc14ac7179dbc4f2/compiler/rustc_middle/src/ty/context/impl_interner.rs#L155

This caused SCIP crashes on the dudykr/stc, renegade-fi/renegade, and
tikv/tikv GitHub repositories, so would presumably cause LSP crashes
too.

The linked trait-system-refactor-initiative issue has a repro, but for
reference I minimised a repro independently:

    trait Tr { const N: usize; }
    struct A<const N: usize>;
    impl<const N: usize> Tr for A<N> { const N: usize = N; }
    const fn k<T: Tr>() -> usize { T::N }
    struct B<const N: usize>;
    impl<const N: usize> Tr for B<N> where A<{ k::<A<3>>() }>: Tr { const N: usize = 0; }
    fn need<T: Tr>() {}
    fn f() { need::<B<1>>(); }

Since this is strictly removing a panic and copying rustc, I haven't
added a unit test with this.

AI disclosure: Triaged and minimised with help by an LLM, but commit
message and final code by me.
fix: Panic when trait solver re-enters itself
…binary_op_error

fix: return an error early for unsupported string binary operations
When an enum variant discriminant
initializer references another variant via a cast, e.g. `B = Foo::A as isize + 1`
the previous implementation would lower `Foo::A` as a place and then extract its
discriminant via `Rvalue::Discriminant`.
This caused infinite recursion during consteval because evaluating the discriminant of one variant requires evaluating another.

# Conflicts:
#	crates/hir-ty/src/mir/lower.rs
…r#18281

`isValidExecutable` was synchronous until rust-lang/rust-analyzer#18281 made
it `async` without updating its only caller. `!isValidExecutable(...)` has
negated a Promise ever since, which is never false, so the check has silently
done nothing for about 2 years.

A bad `rust-analyzer.server.path` therefore failed with

    Cannot activate rust-analyzer extension: undefined

naming neither the binary nor the setting, because vscode-languageclient
rejects with a string rather than an Error. The probe command still runs
and still logs a warning with the real reason.

Also fixed some string messages that were hidden by the dead check:

- missing space after `--version.`, plus a run of indentation pulled in by a
  line continuation inside the template literal
- the bootstrap notification and the `trace.extension` deprecation message
  both pointed at `OUTPUT > Rust Analyzer Client`, which is now called
  `rust-analyzer Extension`

This restores the behaviour from before that change, which I think is
desirable. However, there are two (somewhat uncommon, IMO) things that can
start failing _again_ as a result of restoring this behavior:

- a `server.path` that does not exit 0 on `--version`, even if it speaks LSP
  fine. Yesterday that would log the warning and continue, and would
  work fine. Now it will give an error, which is probably what was
  originally intended there.
- a relative `server.path`, since the probe runs in the extension host's
  working directory while the server is launched in the workspace
  folder.
…ecutable

fix: restore the server binary check broken by rust-lang#18281
vfs-notify registered one recursive `watch()` per directory in the workspace
walk. On macOS, notify's fsevent backend rebuilds the entire FSEventStream on
every `watch()` call, so watching N directories cost O(N^2) realpath/getattrlist
syscalls. This translates to minutes of startup in a large workspace.

Fortunately, the per-directory recursive watches became redundant when
rust-lang/rust-analyzer#21771 switched the watch to `RecursiveMode::Recursive`,
so we can remove most of them. However, symlinked directories are still watched
explicitly because macOS fsevent framework does not follow symlinks on its own.

Result: LSP indexing time for https://github.com/delta-io/delta-kernel-rs on my
macOS laptop dropped from ~11 minutes to ~45 seconds.
fix: watch include roots recursively once, not every directory
lnicola and others added 24 commits October 12, 2026 06:19
fix: When the initializer in `let` diverges, allow non-diverging `else`
…rams

fix: Fix handling of generic params in anon consts
fix: assist do not add lifetime only turbofish
…sure to ensure the temporary folder is removed right after the test is done running
`rust-analyzer` subtree update

Subtree update of `rust-analyzer` to rust-lang/rust-analyzer@f0eebde.

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

r? @ghost
Restrict application of optimization attributes from instance

Previously, `fn_abi_of_instance` would apply various optimization attributes based on `instance.def_id()`, while excluding `Virtual` and `ThreadLocal` variants. This crated a number of actual and latent issues:

- `Reify` can represent a shim performing a virtual call, so restriction on virtual calls was incomplete.
- `DropGlue` is compiler generated and its def id refers a empty placeholder function, so deducing attributes based on its MIR body is nonsensical.
- Various cases of confusion between a shim and a thing it calls.

Conservatively restrict application of optimization attributes to `Item` variant, where it clearly works as intended.

Additionally, allow a few more variants  when calling `fn_can_unwind`:
* `DropGlue` shim, where implementation recognizes it specifically by def id
* `Intrinsic`.

Fixes rust-lang#163856.

cc: @saethlin, @dianqk
Improve `--bless` output for `tests/debuginfo`

Fixes a few small things that came up while writing a new test.

The first commit fixes a small bug that caused unsigned integer values to be unpacked as signed values.

The second forces `\n` line endings, which makes running `--bless` less annoying on windows. Python defaults to platform specific line-endings by default. I think git normalizes away the differences anyway? But when working, they'd show up as changed files, so this just prevents those phantom diffs.

The bigger change in the second commit is sorting the types dictionary, which should help prevent diffs that are just shuffling types around. For reference, python (3.7+) dictionaries are in insertion order by default, so adding a new variable could sometimes cause a type to be processed sooner or later than it had been before.

All other list/dict instances *are* order-sensitive and/or changing their position has significance in the test, so those have remained the same.

r? @jieyouxu, @Kobzol
…moval, r=RalfJung,Urgau

[rustdoc] Move the creation of `IndividualTestOptions` into the test runner closure to ensure the temporary folder is removed right after the test is done running

Fixes rust-lang#164145.

Fixes one missed case in rust-lang#161868: the `IndividualTestOptions` should have been created directly into the `DynTestFn` closure so its temporary directory is removed right after it's done running.

r? @RalfJung
fn_addr_eq: we actually can guarantee basically nothing

Fixes rust-lang#160202.
See that issue for context and discussion.
…uVanilla

Fix transmutability type mismatch bug

Fixes rust-lang#161251

r? @ShoyuVanilla

The change was done as instructed by @ShoyuVanilla and @lcnr on Zulip.
There are some leftover questions I'll add as comments (self review).
But the original examples are both fixed.
…hods-on-infctxt, r=lcnr

Copy over some methods from At to InferCtxt

Replaces rust-lang#163448.

@lcnr wants the `At` struct removed, this is the first step in doing that. This change naively copies over some of the methods from `At` onto `InferCtxt` without removing any calls to `InferCtxt::at` or the `At` methods themselves.
…ars, r=khyperia

-Zassumptions-on-binders: replace region vars with bound vars when handling alias outlives'

r? @khyperia

See added test. Previously when rewriting `<T as Trait<'?x>>::Assoc: 'b` we would just get `ambiguity`, we now produce `for<'x> <T as Trait<'x>>::Assoc: 'b` in the same way that we do when handling too-large-universe placeholders in alias outlives constraints
…egion_vars, r=BoxyUwU

trait solver: Resolve region vars before eager placeholder handling

Region vars can already have known values in the unification table while the stored constraint still contains the vars. `max_universe` looks through the table, but `PlaceholderReplacer` sees the stored terms. In Boxy's nested binder case, that leaves an alias constraint ambiguous even after equating its regions.

I used `deeply_resolve_via_unification_table` at the start of eager handling for each universe. That leaves only the current universe's placeholder to bind and lets the result match the actual assumption on the outer binder. Unknown vars stay unknown.

The test DSL needed a small equality operation, `'a2 = 'a`, to reach this state. The paired outlives constraints in the original example go straight into solver storage and don't populate the table on current main. I kept that example as an ambiguity control and added the version with real table equalities, plus a chained-var case. Both adjusted cases fail when the resolution call is removed and pass with it.

I think keeping this separate makes rust-lang#157984 easier to review. The broader equality and subtyping work stays there.
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label Oct 12, 2026
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 12, 2026
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job test-x86_64-gnu-gcc failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
- error: unable to satisfy constraints involving placeholders due to unknown implied bounds
+ error: forall expect clause failed
+   --> $DIR/region-var-outlives-constraints.rs:19:13
+    |
+ LL |             forall<'b> {
+    |             ^^^^^^
+    |
+ note: constraint from here
+   --> $DIR/region-var-outlives-constraints.rs:19:13
+    |
+ LL |             forall<'b> {
+    |             ^^^^^^
+    = note: expected: Or(
+                [
+                    And(
+                        [],
---
+                                Binder {
+                                    value: (
+                                        Alias {
+                                            kind: Projection {
+                                                def_id: DefId(0:6 ~ region_var_outlives_constraints[0d77]::Trait::Assoc),
+                                            },
+                                            args: [
+                                                T/#1,
+                                                '^0,
+                                                '^1,
---
+                                Binder {
+                                    value: (
+                                        Alias {
+                                            kind: Projection {
+                                                def_id: DefId(0:6 ~ region_var_outlives_constraints[0d77]::Trait::Assoc),
+                                            },
+                                            args: [
+                                                T/#1,
+                                                '^0,
+                                                '^1,
---
+                                Binder {
+                                    value: (
+                                        Alias {
+                                            kind: Projection {
+                                                def_id: DefId(0:6 ~ region_var_outlives_constraints[0d77]::Trait::Assoc),
+                                            },
+                                            args: [
+                                                T/#1,
+                                                '^0,
+                                                '^1,
---
+                                Binder {
+                                    value: (
+                                        Alias {
+                                            kind: Projection {
+                                                def_id: DefId(0:6 ~ region_var_outlives_constraints[0d77]::Trait::Assoc),
+                                            },
+                                            args: [
+                                                T/#1,
+                                                '^0,
+                                                '^1,
---
-   --> /checkout/tests/ui/assumptions_on_binders/region-var-outlives-constraints.rs:27:20
+ error: forall expect clause failed
+   --> $DIR/region-var-outlives-constraints.rs:19:13
+    |
+ LL |             forall<'b> {
+    |             ^^^^^^
+    |
+ note: constraint from here
+   --> $DIR/region-var-outlives-constraints.rs:19:13
+    |
+ LL |             forall<'b> {
+    |             ^^^^^^
+    = note: expected: Or(
+                [
+                    And(
+                        [],
---
+                                Binder {
+                                    value: (
+                                        Alias {
+                                            kind: Projection {
+                                                def_id: DefId(0:6 ~ region_var_outlives_constraints[0d77]::Trait::Assoc),
+                                            },
+                                            args: [
+                                                T/#1,
+                                                '^0,
+                                                '^1,
---
+                                Binder {
+                                    value: (
+                                        Alias {
+                                            kind: Projection {
+                                                def_id: DefId(0:6 ~ region_var_outlives_constraints[0d77]::Trait::Assoc),
+                                            },
+                                            args: [
+                                                T/#1,
+                                                '^0,
+                                                '^1,
---
+                                Binder {
+                                    value: (
+                                        Alias {
+                                            kind: Projection {
+                                                def_id: DefId(0:6 ~ region_var_outlives_constraints[0d77]::Trait::Assoc),
+                                            },
+                                            args: [
+                                                T/#1,
+                                                '^0,
+                                                '^1,
---
+                                Binder {
+                                    value: (
+                                        Alias {
+                                            kind: Projection {
+                                                def_id: DefId(0:6 ~ region_var_outlives_constraints[0d77]::Trait::Assoc),
+                                            },
+                                            args: [
+                                                T/#1,
+                                                '^0,
+                                                '^1,
---
To only update this specific test, also pass `--test-args assumptions_on_binders/region-var-outlives-constraints.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/assumptions_on_binders/region-var-outlives-constraints.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "-Zcodegen-backend=gcc" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/assumptions_on_binders/region-var-outlives-constraints" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2015" "-Zassumptions-on-binders" "-Znext-solver=globally"
stdout: none
--- stderr -------------------------------
error: forall expect clause failed
##[error]  --> /checkout/tests/ui/assumptions_on_binders/region-var-outlives-constraints.rs:19:13
   |
---
                               Binder {
                                   value: (
                                       Alias {
                                           kind: Projection {
                                               def_id: DefId(0:6 ~ region_var_outlives_constraints[0d77]::Trait::Assoc),
                                           },
                                           args: [
                                               T/#1,
                                               '^0,
                                               '^1,
---
                               Binder {
                                   value: (
                                       Alias {
                                           kind: Projection {
                                               def_id: DefId(0:6 ~ region_var_outlives_constraints[0d77]::Trait::Assoc),
                                           },
                                           args: [
                                               T/#1,
                                               '^0,
                                               '^1,
---
                               Binder {
                                   value: (
                                       Alias {
                                           kind: Projection {
                                               def_id: DefId(0:6 ~ region_var_outlives_constraints[0d77]::Trait::Assoc),
                                           },
                                           args: [
                                               T/#1,
                                               '^0,
                                               '^1,
---
                               Binder {
                                   value: (
                                       Alias {
                                           kind: Projection {
                                               def_id: DefId(0:6 ~ region_var_outlives_constraints[0d77]::Trait::Assoc),
                                           },
                                           args: [
                                               T/#1,
                                               '^0,
                                               '^1,

Important

For more information how to resolve CI failures of this job, visit this link.

@rust-bors

rust-bors Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

PR #164103, which is a member of this rollup, was unapproved.

@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rollup A PR which is a rollup

Projects

None yet

Development

Successfully merging this pull request may close these issues.