35660 Commits

Author SHA1 Message Date
Matthias Krüger
f3d4f5f18f
Rollup merge of #143424 - hkBst:auto-deref, r=jhpratt
clippy fix: rely on autoderef

Changes instances of `&**self` to `self`.
2025-07-25 11:16:34 +02:00
Matthias Krüger
e4edf8337e
Rollup merge of #143401 - Enselic:no-stack-backtrace-print-in-display, r=davidtwco
tests: Don't check for self-printed output in std-backtrace.rs test

The `Display` implementation for `Backtrace` used to print

    stack backtrace:

but that print was since removed. See https://github.com/rust-lang/backtrace-rs/pull/286 and https://github.com/rust-lang/rust/pull/69042. To make the existing test pass, the print was added to the test instead. But it doesn't make sense to check for something that the test itself does since that will not detect any regressions in the implementation of `Backtrace`.

What the test _should_ check is that "stack backtrace:" is _not_ printed in `Display` of `Backtrace`. So do that instead.

This is one small steps towards resolving https://github.com/rust-lang/rust/issues/71706. The next steps after this step involves extending and hardening that test further.
2025-07-25 11:16:33 +02:00
Matthias Krüger
e343d3cae1
Rollup merge of #142569 - xizheyin:139253, r=davidtwco
Suggest clone in user-write-code instead of inside macro

Fixes rust-lang/rust#139253

Inspired by rust-lang/rust#142543

r? ````@fmease````
2025-07-25 11:16:32 +02:00
Shoyu Vanilla (Flint)
48ccbe0cd8
Merge pull request #19938 from A4-Tacks/gen-impl-trait
Add ide-assist: generate_impl_trait for generate_impl
2025-07-25 04:16:22 +00:00
Tshepang Mbambo
84010e2d6a
Merge pull request #2518 from rust-lang/rustc-pull
Rustc pull update
2025-07-25 05:36:15 +02:00
A4-Tacks
2a030541fb
Fix gen panics doc template for debug_assert
And add assert_eq, assert_ne, assert_matches support

Input:

```rust
pub fn $0foo(x: bool) {
    debug_assert!(x);
}
```

Old:

```rust
/// .
///
/// # Panics
///
/// Panics if .
pub fn foo(x: bool) {
    debug_assert!(x);
}
```

This PR fixes:

```rust
/// .
pub fn foo(x: bool) {
    debug_assert!(x);
}
```
2025-07-25 11:00:32 +08:00
bors
9959226f5a Auto merge of #144062 - bjorn3:lto_refactors2, r=davidtwco
Various refactors to the LTO handling code (part 2)

Continuing from https://github.com/rust-lang/rust/pull/143388 this removes a bit of dead code and moves the LTO symbol export calculation from individual backends to cg_ssa.
2025-07-24 12:50:26 +00:00
Oli Scherer
31b88819c7 Remove dead code and extend test coverage and diagnostics around it
We lost the following comment during refactorings:

The current code for niche-filling relies on variant indices instead of actual discriminants, so enums with explicit discriminants (RFC 2363) would misbehave.
2025-07-24 10:21:20 +00:00
Chayim Refael Friedman
922e04a134
Merge pull request #20297 from A4-Tacks/fix-ws-gen-trait-from-impl
Fix generate_trait_from_impl whitespace after vis
2025-07-24 09:41:20 +00:00
A4-Tacks
cf299690a9
Fix generate_trait_from_impl whitespace after vis
Input:

```rust
struct Foo;

impl F$0oo {
    pub fn a_func() -> Option<()> {
        Some(())
    }
}
```

Old:

```rust
struct Foo;

trait NewTrait {
     fn a_func() -> Option<()>;
}

impl NewTrait for Foo {
     fn a_func() -> Option<()> {
        Some(())
    }
}
```

This PR fixed:

```rust
struct Foo;

trait NewTrait {
    fn a_func() -> Option<()>;
}

impl NewTrait for Foo {
    fn a_func() -> Option<()> {
        Some(())
    }
}
```
2025-07-24 15:06:56 +08:00
The rustc-josh-sync Cronjob Bot
1ebfd77437 Merge ref 'efd420c770bb' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: efd420c770bb179537c01063e98cb6990c439654
Filtered ref: d11dbbb02905535a89393e80c24274bee81fa928

This merge was created using https://github.com/rust-lang/josh-sync.
2025-07-24 04:15:39 +00:00
bors
b516b302ef Auto merge of #144244 - jieyouxu:pr-full-ci, r=Kobzol
Enforce that PR CI jobs are a subset of Auto CI jobs modulo carve-outs

### Background

Currently, it is possible for a PR with red PR-only CI to pass Auto CI, then all subsequent PR CI runs will be red until that is fixed, even in completely unrelated PRs. For instance, this happened with PR-CI-only Spellcheck (rust-lang/rust#144183).

See more discussions at [#t-infra > Spellcheck workflow now fails on all PRs (tree bad?)](https://rust-lang.zulipchat.com/#narrow/channel/242791-t-infra/topic/Spellcheck.20workflow.20now.20fails.20on.20all.20PRs.20.28tree.20bad.3F.29/with/529769404).

### CI invariant: PR CI jobs are a subset of Auto CI jobs modulo carve-outs

To prevent red PR CI in completely unrelated subsequent PRs and PR CI runs, we need to maintain an invariant that **PR CI jobs are a subset of Auto CI jobs modulo carve-outs**.

This is **not** a "strict" subset relationship: some jobs necessarily have to differ under PR CI and Auto CI environments, at least in the current setup. Still, we can try to enforce a weaker "subset modulo carve-outs" relationship between CI jobs and their corresponding Auto jobs. For instance:

- `x86_64-gnu-tools` will have `auto`-only env vars like `DEPLOY_TOOLSTATES_JSON: toolstates-linux.json`.
- `tidy` will want to `continue_on_error: true` in PR CI to allow for more "useful" compilation errors to also be reported, whereas it should be `continue_on_error: false` in Auto CI to prevent wasting Auto CI resources.

The **carve-outs** are:

1. `env` variables.
2. `continue_on_error`.

We enforce this invariant through `citool`, so only affects job definitions that are handled by `citool`. Notably, this is not sufficient *alone* to address the CI-only Spellcheck issue (rust-lang/rust#144183). To carry out this enforcement, we modify `citool` to auto-register PR jobs as Auto jobs with `continue_on_error` overridden to `false` **unless** there's an overriding Auto job for the PR job of the same name that only differs by the permitted **carve-outs**.

### Addressing the Spellcheck PR-only CI issue

Note that Spellcheck currently does not go through `citool` or `bootstrap`, and is its own GitHub Actions workflow. To actually address the PR-CI-only Spellcheck issue (rust-lang/rust#144183), and carry out the subset-modulo-carve-outs enforcement universally, this PR additionally **removes the current Spellcheck implementation** (a separate GitHub Actions Workflow). That is incompatible with Homu unless we do some hacks in the main CI workflow.

This effectively partially reverts rust-lang/rust#134006 (the separate workflow part, not the tidy extra checks component), but is not prejudice against relanding the `typos`-based spellcheck in another implementation that goes through the usual bootstrap CI workflow so that it does work with Homu. The `typos`-based spellcheck seems to have a good false-positive rate.

Closes rust-lang/rust#144183.

---

r? infra-ci
2025-07-23 23:19:41 +00:00
bors
32b73fc7ae Auto merge of #144233 - cjgillot:unsat-mir, r=oli-obk
Consider parent predicates in ImpossiblePredicates pass.

This pass is double edged. It avoids some ICEs (yay!) but also degrades diagnostics from constant evaluation.

Fixes rust-lang/rust#121363
Fixes rust-lang/rust#131507
Fixes rust-lang/rust#140100
Fixes rust-lang/rust#140365
2025-07-23 20:16:03 +00:00
Chayim Refael Friedman
b5b10fb10f
Merge pull request #20291 from ChayimFriedman2/fix-cargo-lock
minor: Fix Cargo.lock
2025-07-23 14:46:47 +00:00
Shoyu Vanilla
d5379d3103 Use TempDir for copied lockfiles 2025-07-23 23:39:46 +09:00
Chayim Refael Friedman
f08c554f29 Fix Cargo.lock
The dependency of `xtask` on `time` was mistakenly removed.
2025-07-23 17:35:08 +03:00
Chayim Refael Friedman
1bf93c38ad
Merge pull request #20285 from A4-Tacks/fix-rename-self
Change rename self to parameter use `Self` type
2025-07-23 14:29:07 +00:00
A4-Tacks
9ecd82be13
Remove rename_self_outside_of_methods 2025-07-23 22:04:59 +08:00
Lukas Wirth
97593ea9c6
Merge pull request #20289 from ChayimFriedman2/expr-store-diags-macros
internal: Remove `ExpressionStoreDiagnostics::MacroError`, instead recreate it from the `MacroCallId`
2025-07-23 13:58:10 +00:00
Chayim Refael Friedman
963a1317e7 Remove ExpressionStoreDiagnostics::MacroError, instead recreate it from the MacroCallId
This simplifies the code and also makes us report parse error in macros too.
2025-07-23 16:27:07 +03:00
A4-Tacks
4b32a49ef1
Change rename self to parameter use Self type
And add `&self` lifetime support

Example
===

Rename to `this`

```rust
struct Foo<T>(T);
impl Foo<i32> {
    fn foo(&'static self$0) {}
}
```

Old:

```rust
struct Foo<T>(T);
impl Foo<i32> {
    fn foo(this: &Foo) {}
}
```

Fixes:

```rust
struct Foo<T>(T);
impl Foo<i32> {
    fn foo(this: &'static Self) {}
}
```
2025-07-23 13:51:28 +08:00
bors
0a02ffd83a Auto merge of #143897 - cjgillot:derive-walk, r=petrochenkov
Implement AST visitors using a derive macro.

AST visitors are large and error-prone beasts. This PR attempts to write them using a derive macro.

The design uses three traits: `Visitor`, `Visitable`, `Walkable`.
- `Visitor` is the trait implemented by downstream crates, it lists `visit_stuff` methods, which call `Walkable::walk_ref` by default;
- `Walkable` is derived using the macro, the generated `walk_ref` method calls `Visitable::visit` on each component;
- `Visitable` is implemented by `common_visitor_and_walkers` macro, to call the proper `Visitor::visit_stuff` method if it exists, to call `Walkable::walk_ref` if there is none.

I agree this is quite a lot of spaghetti macros. I'm open to suggestions on how to reduce the amount of boilerplate code.

If this PR is accepted, I believe the same design can be used for the HIR visitor.
2025-07-23 04:24:50 +00:00
Shoyu Vanilla (Flint)
fa64d3b720
Merge pull request #20281 from ChayimFriedman2/parse-hrtb-const
fix: Parse `for<'a> [const]`
2025-07-23 01:50:16 +00:00
Laurențiu Nicola
b40fce3ccd
Merge pull request #20280 from Kobzol/josh-sync
Switch to using josh-sync
2025-07-22 17:08:34 +00:00
Laurențiu Nicola
8d693ce4d5
Merge pull request #20282 from Kobzol/josh-sync-ci
Add CI workflow for periodically performing josh pulls
2025-07-22 17:08:00 +00:00
Jakub Beránek
ca679a2f94
Add CI workflow for periodically performing josh pulls 2025-07-22 18:15:54 +02:00
Jakub Beránek
00a47e3299
Apply suggestions from code review
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2025-07-22 18:14:20 +02:00
bors
8c24528bb8 Auto merge of #144222 - Kobzol:stdarch-push, r=folkertdev
stdarch subtree update

Subtree update of `stdarch` to 5531955678.

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

I saw that there were non-trivial changes made to `std_detect` in `stdarch` recently. So I want to get them merged here before we move forward with https://github.com/rust-lang/rust/pull/143412.

r? `@folkertdev`
2025-07-22 15:25:31 +00:00
Jakub Beránek
9c1750d0b5
Document synces using josh-sync 2025-07-22 15:25:18 +02:00
Jakub Beránek
ceaa0376ef
Remove pull/push functionality from xtask 2025-07-22 15:25:16 +02:00
Chayim Refael Friedman
c7ceb39f67 Parse for<'a> [const]
And also refactor parsing of HRTB.
2025-07-22 16:24:42 +03:00
Laurențiu Nicola
a54351effd
Merge pull request #20279 from lnicola/add-josh-sync
internal: Add `josh-sync.toml`
2025-07-22 13:08:09 +00:00
Laurențiu Nicola
091ba7fd32 Add josh-sync.toml 2025-07-22 15:56:41 +03:00
Shoyu Vanilla (Flint)
578a523686
Merge pull request #20277 from rust-lang/dependabot/npm_and_yarn/editors/code/form-data-4.0.4
Bump form-data from 4.0.2 to 4.0.4 in /editors/code
2025-07-22 11:11:53 +00:00
Florian Diebold
6e4e0883b0
Merge pull request #20278 from lnicola/analysis-stats-mir-lowering-only
internal: Support filtering in analysis-stats MIR lowering
2025-07-22 08:35:41 +00:00
bors
9b11f5a0ce Auto merge of #144205 - hkBst:flt2dec, r=workingjubilee
flt2dec: replace for loop by iter_mut

Perf is explored in https://github.com/rust-lang/rust/issues/144118, which initially showed small losses, but then also showed significant gains. Both are real, but given the smallness of the losses, this seems a good change.
2025-07-22 08:28:29 +00:00
Laurențiu Nicola
c9b07766b7 Support filtering in analysis-stats MIR lowering 2025-07-22 11:22:16 +03:00
dependabot[bot]
36e31f9142
Bump form-data from 4.0.2 to 4.0.4 in /editors/code
Bumps [form-data](https://github.com/form-data/form-data) from 4.0.2 to 4.0.4.
- [Release notes](https://github.com/form-data/form-data/releases)
- [Changelog](https://github.com/form-data/form-data/blob/master/CHANGELOG.md)
- [Commits](https://github.com/form-data/form-data/compare/v4.0.2...v4.0.4)

---
updated-dependencies:
- dependency-name: form-data
  dependency-version: 4.0.4
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-22 05:30:29 +00:00
Shoyu Vanilla (Flint)
bdfc7709bf
Merge pull request #20269 from Hmikihiro/migrate_indent_mapping
Migrate AstNodeEdit::Indent to SyntaxEditor
2025-07-22 04:07:47 +00:00
Shoyu Vanilla (Flint)
7cbc5a3d57
Merge pull request #20270 from Hmikihiro/migrate_generate_new
Migrate `generate new` assist to use `SyntaxEditor`
2025-07-22 03:41:03 +00:00
bors
daa33520f2 Auto merge of #144269 - jieyouxu:rollup-137ysl2, r=jieyouxu
Rollup of 14 pull requests

Successful merges:

 - rust-lang/rust#142097 (gpu offload host code generation)
 - rust-lang/rust#143430 (Lower extra lifetimes before normal generic params.)
 - rust-lang/rust#143768 (Constify Try, From, TryFrom and relevant traits)
 - rust-lang/rust#143816 (Implement `check` for compiletest and RA using tool macro)
 - rust-lang/rust#143985 (rustc_public: de-StableMIR-ize)
 - rust-lang/rust#144027 (clippy: make tests work in stage 1)
 - rust-lang/rust#144080 (Mitigate `#[align]` name resolution ambiguity regression with a rename)
 - rust-lang/rust#144176 (Add approval blocking labels for new bors)
 - rust-lang/rust#144187 (fix handling of base address for TypeId allocations)
 - rust-lang/rust#144212 (Remove the ptr_unique lang item)
 - rust-lang/rust#144243 (Subtree update of `rust-analyzer`)
 - rust-lang/rust#144246 (Don't use another main test file as auxiliary)
 - rust-lang/rust#144251 (rustc-dev-guide subtree update)
 - rust-lang/rust#144254 (opt-dist: make `artifact-dir` an absolute path for `opt-dist local`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-21 19:48:22 +00:00
许杰友 Jieyou Xu (Joe)
05737ad03a
Rollup merge of #144254 - ognevny:opt-dist-artifact-dir, r=Kobzol
opt-dist: make `artifact-dir` an absolute path for `opt-dist local`

...like for CI environments. the same logic applied as for `build_dir`. fixes the issue where some intermediate steps fail due to path being relative to an active directory

r? Kobzol

try-job: dist-x86_64-msvc
try-job: dist-x86_64-linux
2025-07-22 00:54:33 +08:00
许杰友 Jieyou Xu (Joe)
3290c665ff
Rollup merge of #144251 - tshepang:rdg-sync, r=jieyouxu
rustc-dev-guide subtree update

Subtree update of `rustc-dev-guide` to cca233729f.

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

r? ```@ghost```
2025-07-22 00:54:32 +08:00
许杰友 Jieyou Xu (Joe)
3a9ffd37ee
Rollup merge of #144246 - jieyouxu:no-dual-test, r=lqd,RalfJung
Don't use another main test file as auxiliary

In this case, the exact extern crate isn't very important, it just needs to not be another main test file.

This is part of the changes needed to address the spurious failures from a main test `../removing-extern-crate.rs` being both an auxiliary and a main test file, causing fs races due to multiple `rustc` processes in multiple test threads trying to build the main test file both as a main test and also as an auxiliary at around the same time.

Part 1 of rust-lang/rust#144237.

r? ``@RalfJung`` (or compiler)
2025-07-22 00:54:32 +08:00
许杰友 Jieyou Xu (Joe)
1bcd093474
Rollup merge of #144243 - lnicola:sync-from-ra, r=lnicola
Subtree update of `rust-analyzer`

r? ```@ghost```
2025-07-22 00:54:31 +08:00
许杰友 Jieyou Xu (Joe)
181c0956d9
Rollup merge of #144027 - RalfJung:clippy, r=Mark-Simulacrum
clippy: make tests work in stage 1

This finally fixes https://github.com/rust-lang/rust/issues/78717 :)

Similar to what Miri already does, the clippy test step needs to carefully consider  which compiler is used to build clippy and which compiler is linked into clippy (and thus must be used to build the test dependencies). On top of that we have some extra complications that Miri avoided by using `cargo-miri` for building its test dependencies: we need cargo to use the right rustc and the right sysroot, but https://github.com/rust-lang/cargo/issues/4423 makes this quite hard to do. See the long comment in `src/tools/clippy/tests/compile-test.rs` for details.

Some clippy tests tried to import rustc crates; that fundamentally requires a full bootstrap loop so it cannot work in stage 1. I had to kind of guess what those tests were doing so I don't know if my changes there make any sense.

Cc ```@flip1995``` ```@Kobzol```
2025-07-22 00:54:28 +08:00
Chayim Refael Friedman
9a1ee18e4d
Merge pull request #20273 from ShoyuVanilla/match-adjusts
fix: Apply adjusts to pats and exprs when doing pat analysis
2025-07-21 16:31:09 +00:00
Shoyu Vanilla
e587367b4d fix: Apply adjusts to pats and exprs when doing pat analysis 2025-07-22 01:18:48 +09:00
Laurențiu Nicola
0d4f56de04
Merge pull request #20272 from glaubitz/x32-fixes
hir-def: Don't apply x86_64-specific asserts on x32
2025-07-21 15:18:46 +00:00
John Paul Adrian Glaubitz
25122d9289 hir-def: Don't apply x86_64-specific asserts on x32
This fixes the rustc build on x32 for which struct sizes differ.
2025-07-21 17:03:07 +02:00