Commit graph

307855 commits

Author SHA1 Message Date
A4-Tacks
e6656c19b4
Fix invalid RestPat for convert_tuple_struct_to_named_struct
```rust
struct X$0(i8, i16, i32, i64);
fn foo(X(a, .., d): X) {}
```

**Before this PR**:

```rust
struct X { field1: i8, field2: i16, field3: i32, field4: i64 }
fn foo(X { field1: a, field2: .., field3: d }: X) {}
```

**After this PR**:

```rust
struct X { field1: i8, field2: i16, field3: i32, field4: i64 }
fn foo(X { field1: a, field4: d, .. }: X) {}
```
2025-10-21 11:52:06 +08:00
Shoyu Vanilla (Flint)
7c871c2a4b
Merge pull request #20860 from A4-Tacks/migrate-single-field-from
Migrate `generate_single_field_struct_from` assist to use `SyntaxEditor`
2025-10-19 17:04:56 +00:00
Shoyu Vanilla (Flint)
b6c29e07ba
Merge pull request #20845 from A4-Tacks/migrate-add-braces
Migrate `add_braces` assist, because edit_in_place uses ted
2025-10-19 17:03:59 +00:00
Shoyu Vanilla (Flint)
e1a923a21e
Merge pull request #20852 from ChayimFriedman2/xtask-install-never
Do not use `force-always-assert` in `xtask install` by default
2025-10-19 17:01:40 +00:00
Shoyu Vanilla (Flint)
400896d1e1
Merge pull request #20841 from ChayimFriedman2/to-ns
Migrate more stuff to the next solver
2025-10-19 17:00:44 +00:00
A4-Tacks
d3263775c4
Migrate generate_single_field_struct_from assist to use SyntaxEditor 2025-10-18 10:21:35 +08:00
David Barsky
7a15d6d4f1
Merge pull request #20855 from ChayimFriedman2/improve-fixture2
feat: Improve fixture support
2025-10-17 15:18:06 +00:00
Chayim Refael Friedman
090b47ab39
Merge pull request #20858 from A4-Tacks/inlay-suffix-underscore
Support underscore suffix parameter hide inlayHints
2025-10-17 13:40:23 +00:00
A4-Tacks
9a2db55596
Support underscore suffix parameter hide inlayHints
Using suffix underscores to avoid keywords is one of the common skill, and inlayHints hiding should support it

Example
---

**Before this PR**:

```rust
fn far(loop_: u32) {}
fn faz(r#loop: u32) {}

let loop_level = 0;
far(loop_level);
  //^^^^^^^^^^ loop_
faz(loop_level);
```

**After this PR**:

```rust
fn far(loop_: u32) {}
fn faz(r#loop: u32) {}

let loop_level = 0;
far(loop_level);
faz(loop_level);
```
2025-10-17 18:51:18 +08:00
Chayim Refael Friedman
db6734e22f Improve fixture support
Support more features beside highlighting, and support items from minicore.
2025-10-16 22:06:16 +03:00
Chayim Refael Friedman
e9bba4f598 Do not use force-always-assert in xtask install by default
But add a flag to do so.
2025-10-16 13:08:27 +03:00
Lukas Wirth
082ecd8f73
Merge pull request #20757 from Shourya742/force-fileid-invariant-to-interner
Use FileId::MAX for id assertion in PathInterner::intern
2025-10-16 07:37:06 +00:00
A4-Tacks
b2566ff07b
Migrate add_braces assist, because edit_in_place uses ted
- And fix indent

Example
---
```rust
fn foo() {
    {
        match n {
            Some(n) $0=> foo(
                29,
                30,
            ),
            _ => ()
        };
    }
}
```

**Before this PR**:

```rust
fn main() {
    {
        match n {
            Some(n) => {
                foo(
                            29,
                            30,
                        )
            },
            _ => ()
        };
    }
}
```

**After this PR**:

```rust
fn foo() {
    {
        match n {
            Some(n) => {
                foo(
                    29,
                    30,
                )
            },
            _ => ()
        };
    }
}
```
2025-10-15 19:26:59 +08:00
Chayim Refael Friedman
a78b257b31
Merge pull request #20836 from Elliot-Roberts/cfg-require-tt
Fix compile error in `crates/cfg` tests due to `tt` feature
2025-10-15 03:03:52 +00:00
Chayim Refael Friedman
25ed1c5bfb Migrate Display impls to the next solver 2025-10-14 21:30:34 +03:00
Chayim Refael Friedman
562e0890c5
Merge pull request #20835 from ShoyuVanilla/ra-ra
minor: Fix creating `rust-analyzer/rust-analyzer` under target-dir
2025-10-14 15:53:39 +00:00
Laurențiu Nicola
34b19c274e
Merge pull request #20840 from lnicola/fix-lockfile
minor: Fix lockfile
2025-10-14 11:45:52 +00:00
Laurențiu Nicola
0634661796 Fix lockfile 2025-10-14 14:34:14 +03:00
Laurențiu Nicola
a4b486ae37
Merge pull request #20839 from lnicola/rustc-pull
minor: sync from downstream
2025-10-14 11:05:18 +00:00
Laurențiu Nicola
cd101ef80e Bump rustc crates a little 2025-10-14 13:34:47 +03:00
Laurențiu Nicola
0430ba2085 Merge ref 'fb24b04b09' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: fb24b04b09
Filtered ref: 8d328b994c70dfeed12717a13a915703ec939cfc
Upstream diff: 3369e82c6b...fb24b04b09

This merge was created using https://github.com/rust-lang/josh-sync.
2025-10-14 13:31:56 +03:00
Laurențiu Nicola
78bbc598b8 Prepare for merging from rust-lang/rust
This updates the rust-version file to fb24b04b09.
2025-10-14 13:27:01 +03:00
Shoyu Vanilla (Flint)
63f364601a
Merge pull request #20673 from A4-Tacks/break-value
Add break value completion support
2025-10-14 08:59:29 +00:00
A4-Tacks
1d2c84d57e
Add break value completion support
```rust
fn foo() -> i32 {
    loop {
        $0
    }
}
```

**Before this PR**:

```rust
fn foo() -> i32 {
    loop {
        break;
    }
}
```

**After this PR**:

```rust
fn foo() -> i32 {
    loop {
        break $0;
    }
}
```
2025-10-14 16:37:32 +08:00
Shoyu Vanilla (Flint)
4794fb9562
Merge pull request #20772 from A4-Tacks/fix-nested-pull-assign-up
Fix not applicable match inside if for pull_assignment_up
2025-10-14 07:58:34 +00:00
Shoyu Vanilla (Flint)
0ebc92abd2
Merge pull request #20758 from A4-Tacks/guarded-if-let-else
Add else-block support for convert_to_guarded_return
2025-10-14 07:51:59 +00:00
Shoyu Vanilla (Flint)
f4beb80f33
Merge pull request #20838 from A4-Tacks/conv-to-guard-ret-exist-else
Fix applicable on let-else for convert_to_guarded_return
2025-10-14 07:40:17 +00:00
A4-Tacks
1597162eea
Fix applicable on let-else for convert_to_guarded_return
Example
---
```rust
fn foo() -> bool {
    let$0 Some(x) = Some(2) else { return false };
}
```

**Before this PR**:

```rust
fn foo() -> bool {
    let Some(Some(x)) = Some(2) else { return };
}
```

**After this PR**:

Assist not applicable
2025-10-14 14:47:08 +08:00
bors
fb24b04b09 Auto merge of #147353 - the8472:nondrop-array-iter, r=scottmcm
only call polymorphic array iter drop machinery when the type requires it

I saw a bunch of dead, empty  `<[core::mem::maybe_uninit::MaybeUninit<T>; N] as core::array::iter::iter_inner::PartialDrop>::partial_drop` functions when compiling with more than 1 CGU.

Let's see if we can help optimizations to eliminate stuff earlier.

r? ghost
2025-10-14 05:29:24 +00:00
bors
4b94758d2b Auto merge of #147640 - matthiaskrgr:rollup-fio3d88, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#144266 (Supress swapping lhs and rhs in equality suggestion in extern macro )
 - rust-lang/rust#147471 (Assert that non-extended temporaries and `super let` bindings have scopes)
 - rust-lang/rust#147533 (Renumber return local after state transform)
 - rust-lang/rust#147566 (rewrite outlives placeholder constraints to outlives static when handling opaque types)
 - rust-lang/rust#147613 (Make logging filters work again by moving EnvFilter into its own layer)
 - rust-lang/rust#147615 (reduce calls to attr.span() in old doc attr parsing)
 - rust-lang/rust#147636 (miri subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-13 19:22:06 +00:00
bors
ed1d94311e Auto merge of #147541 - saethlin:transmute-carefully, r=scottmcm
Change int-to-ptr transmute lowering back to inttoptr

This is a revert of https://github.com/rust-lang/rust/pull/121282, but with a regression test to cover the reported miscompile in https://github.com/rust-lang/rust/issues/147265 that was caused by the way the code here combines with https://github.com/rust-lang/rust/pull/138759.
2025-10-13 15:24:11 +00:00
Matthias Krüger
8d2b142a73
Rollup merge of #147636 - RalfJung:miri, r=RalfJung
miri subtree update

Subtree update of `miri` to 47d656832c.

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

r? `@ghost`
2025-10-13 16:54:15 +02:00
Matthias Krüger
81dd4082ab
Rollup merge of #147615 - jdonszelmann:span-calls-doc-attr, r=JonathanBrouwer,GuillaumeGomez
reduce calls to attr.span() in old doc attr parsing

r? `@oli-obk`

should be trivial, can also delegate to `@GuillaumeGomez` or `@JonathanBrouwer.`

As part of making span() return an option I want to reduce the number of places we call span in without it being known what specific attr it's for. This makes that more obvious for doc. Part of a chain of PRs that's coming.

https://github.com/rust-lang/rust/issues/131229#issuecomment-3395316064
2025-10-13 16:54:15 +02:00
Matthias Krüger
806da59bd1
Rollup merge of #147613 - dingxiangfei2009:investigate-log, r=jdonszelmann
Make logging filters work again by moving EnvFilter into its own layer

`tracing` at the time of writing has a feature (?) in its Filter implementation, so that filters like EnvFilter are consulted for status of a span or event and whether it is marked as interesting for logging. Combining a Filter with another layer through the `with_filter` combinator produces a filtered layer that enables an event unless it is statically determined that the event is uninteresting. However, if the filter is dynamic, because of filtering on span names or field values as an example, events are **always** enabled by design. There is an `event_enabled` predicate on `EnvFilter` implementation but it falls back to default and, thus, the dynamic filters are **unused**.

Previously, `RUSTC_LOG=[]` or `RUSTC_LOG=[garbage]` enables all events, even when spans do not match.

This patch re-enables span- and field-based filters. With `RUSTC_LOG=[garbage]` one should expect no events are enabled again. This will help with development greatly because we can meaningfully filter internal logs again.
2025-10-13 16:54:14 +02:00
Matthias Krüger
7d0a0a3660
Rollup merge of #147566 - BoxyUwU:opaque_types_placeholder_outlives, r=lcnr
rewrite outlives placeholder constraints to outlives static when handling opaque types

Fixes rust-lang/rust#147529

r? lcnr

see test comment
2025-10-13 16:54:13 +02:00
Matthias Krüger
6dd08cbd45
Rollup merge of #147533 - cjgillot:coro-late-renumber, r=davidtwco
Renumber return local after state transform

The current implementation of `StateTransform` renames `_0` before analyzing liveness. This is inconsistent, as a `return` terminator hardcodes a read of `_0`.

This PR proposes to perform such rename *after* analyzing the body, in fact after the whole transform. The implementation is not much more complicated.
2025-10-13 16:54:13 +02:00
Matthias Krüger
2a10082bcc
Rollup merge of #147471 - dianne:assert-temporary-scope, r=nnethercote
Assert that non-extended temporaries and `super let` bindings have scopes

This PR clarifies a point of confusion in the compiler: all bodies have an outer temporary drop scope, including `static` and `const` item bodies[^1]. Whenever a temporary should be dropped in its enclosing temporary scope, it should have a temporary scope to be dropped in so that its drop can be scheduled[^2]. As such, I've updated some relevant comments and made `ScopeTree::default_temporary_scope` and `RvalueScopes::temporary_scope` panic when an enclosing temporary scope isn't found instead of allowing potential bugs where potentially-drop-sensitive temporaries are effectively given static lifetimes.

Since non-extended `super let` bindings are dropped in their block's enclosing temporary scope, this applies to them as well: the enclosing temporary scope should exist.

[^1]: See https://github.com/rust-lang/rust/blob/master/compiler/rustc_hir_analysis/src/check/region.rs#L773-L778 for non-`fn`/closure bodies. The `this.cx.var_parent = None;` enables [lifetime extension to `'static` lifetimes](https://doc.rust-lang.org/stable/reference/destructors.html#r-destructors.scope.lifetime-extension.static) and the `ScopeData::Destruction` scope ensures non-extended temporaries are dropped in the body expression's scope.

[^2]: For certain borrowed temporaries, drops that don't require running destructors may later be removed by constant promotion. That is unrelated to this PR.
2025-10-13 16:54:12 +02:00
Matthias Krüger
852198534f
Rollup merge of #144266 - xizheyin:139050, r=nnethercote
Supress swapping lhs and rhs in equality suggestion in extern macro

Fixes rust-lang/rust#139050
2025-10-13 16:54:11 +02:00
Boxy Uwu
30bedc74d4 in opaque type handling lift region vars to static if they outlive placeholders 2025-10-13 15:26:22 +01:00
bors
9b8264604e Auto merge of #147629 - GuillaumeGomez:rollup-i1zinjv, r=GuillaumeGomez
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#147514 (repr_transparent_external_private_fields: normalize types during traversal)
 - rust-lang/rust#147605 (Add doc links between `{integer}::from_str_radix` and `from_str`)
 - rust-lang/rust#147608 (cg_llvm: Use `LLVMDIBuilderCreateGlobalVariableExpression`)
 - rust-lang/rust#147623 (Clear `ChunkedBitSet` without reallocating)
 - rust-lang/rust#147625 (Add a warning when running tests with the GCC backend and debug assertions are enabled)
 - rust-lang/rust#147626 (Generalize configuring LLD as the default linker in bootstrap)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-13 12:13:05 +00:00
Guillaume Gomez
0e6ec72dbe
Rollup merge of #147626 - Kobzol:lld-generalize2, r=jieyouxu
Generalize configuring LLD as the default linker in bootstrap

Reopen of https://github.com/rust-lang/rust/pull/147157, because apparently bors can't deal with it for some reason.

r? ``@ghost``
2025-10-13 11:25:25 +02:00
Guillaume Gomez
8ced599ba2
Rollup merge of #147625 - Kobzol:gcc-debug-assertions, r=GuillaumeGomez
Add a warning when running tests with the GCC backend and debug assertions are enabled

Discussed at https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Run.20more.20tests.20for.20rustc_codegen_gcc.20in.20t.E2.80.A6.20compiler-team.23891/with/543701828.

r? ``@GuillaumeGomez``
2025-10-13 11:25:24 +02:00
Guillaume Gomez
d808d28452
Rollup merge of #147623 - Zalathar:clear-mixed, r=nnethercote
Clear `ChunkedBitSet` without reallocating

There doesn't appear to be any reason to clear a ChunkedBitSet via its constructor (which allocates a new list of chunks), when we could just fill the existing allocation with `Chunk::Zeros` instead.

For comparison, the `insert_all` impl added by the same PR (rust-lang/rust#93984) does the simple thing here and just overwrites every chunk with `Chunk::Ones`.

(That fill was then made somewhat easier by rust-lang/rust#145480, which removes the chunk size from all-zero/all-one chunks.)

r? nnethercote (or compiler)
2025-10-13 11:25:23 +02:00
Guillaume Gomez
3938f42bb1
Rollup merge of #147608 - Zalathar:debuginfo, r=nnethercote
cg_llvm: Use `LLVMDIBuilderCreateGlobalVariableExpression`

- Part of rust-lang/rust#134001
- Follow-up to rust-lang/rust#146763

---

This PR dismantles the somewhat complicated `LLVMRustDIBuilderCreateStaticVariable` function, and replaces it with equivalent calls to `LLVMDIBuilderCreateGlobalVariableExpression` and `LLVMGlobalSetMetadata`.

A key difference is that the new code does not replicate the attempted downcast of `InitVal`. As far as I can tell, those downcasts were actually dead, because `llvm::ConstantInt` and `llvm::ConstantFP` are not subclasses of `llvm::GlobalVariable`. I tried replacing those code paths with fatal errors, and was unable to induce failure in any of the relevant test suites I ran.

I have also confirmed that if the calls to `create_static_variable` are commented out, debuginfo tests will fail, demonstrating some amount of relevant test coverage.

The new `DIBuilder` methods have been added via an extension trait, not as inherent methods, to avoid impeding rust-lang/rust#142897.
2025-10-13 11:25:23 +02:00
Guillaume Gomez
b7ea44a49d
Rollup merge of #147605 - Zalathar:from-str-radix, r=Mark-Simulacrum
Add doc links between `{integer}::from_str_radix` and `from_str`

When parsing base-10 numbers, it's easy to miss `<Self as FromStr>::from_str` and `str::parse` as potential alternatives to `from_str_radix`.

- A similar suggestion is given by https://rust-lang.github.io/rust-clippy/master/index.html#from_str_radix_10
2025-10-13 11:25:22 +02:00
Guillaume Gomez
4a7e152511
Rollup merge of #147514 - RalfJung:transparent-nonexhaustive-normalize, r=lcnr
repr_transparent_external_private_fields: normalize types during traversal

Determining whether a type is a 1-ZST will internally do full normalization, so we better do the same when scanning for non-exhaustive types.

r? ``@lcnr``
2025-10-13 11:25:21 +02:00
Ralf Jung
15716a33ac
Merge pull request #4627 from RalfJung/rustup
Rustup
2025-10-13 09:18:35 +00:00
bors
956f47c32f Auto merge of #147502 - camsteffen:split-overlapping-impls, r=fmease
Split overlapping_{inherent,trait}_impls

This yielded some perf improvement for me. Reduces some calls to `impl_trait_header` query. But I think the llvm optimization is more relevant.
2025-10-13 09:05:36 +00:00
Ralf Jung
0c2e30bc1a avoid blanket allow(unused) 2025-10-13 10:44:31 +02:00
Ralf Jung
aec62f83bd fmt 2025-10-13 10:36:03 +02:00