35566 Commits

Author SHA1 Message Date
Shoyu Vanilla (Flint)
51e77c9d7b
Merge pull request #20293 from Hmikihiro/migrate_replace_derive_with_manual_impl
Migrate `replace derive with manual impl` and `add_missing_impl_members` to use `SyntaxEditor`
2025-07-25 15:40:26 +00:00
Hayashi Mikihiro
82dfdacb78 Modify around add_trait_assoc_items_to_impl to migrate add_missing_impl_members
Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
2025-07-26 00:22:29 +09:00
Hmikihiro
827e3f7c17 migrate_replace_derive_with_manual_impl 2025-07-25 19:50:44 +09:00
Hmikihiro
4a0527f78c split ted from gen_trait_fn_body 2025-07-25 19:50:44 +09:00
bors
c2c1ab178b Auto merge of #144440 - matthiaskrgr:rollup-peb88gb, r=matthiaskrgr
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#142569 (Suggest clone in user-write-code instead of inside macro)
 - rust-lang/rust#143401 (tests: Don't check for self-printed output in std-backtrace.rs test)
 - rust-lang/rust#143424 (clippy fix: rely on autoderef)
 - rust-lang/rust#143970 (Update core::mem::copy documentation)
 - rust-lang/rust#143979 (Test fixes for Arm64EC Windows)
 - rust-lang/rust#144200 (Tweak output for non-`Clone` values moved into closures)
 - rust-lang/rust#144209 (Don't emit two `assume`s in transmutes when one is a subset of the other)
 - rust-lang/rust#144314 (Hint that choose_pivot returns index in bounds)
 - rust-lang/rust#144340 (UI test suite clarity changes: Rename `tests/ui/SUMMARY.md` and update rustc dev guide on `error-pattern`)
 - rust-lang/rust#144368 (resolve: Remove `Scope::CrateRoot`)
 - rust-lang/rust#144390 (Remove dead code and extend test coverage and diagnostics around it)
 - rust-lang/rust#144392 (rustc_public: Remove movability from `RigidTy/AggregateKind::Coroutine`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-25 10:40:01 +00:00
Matthias Krüger
9813f19c79
Rollup merge of #144392 - makai410:rm-mov, r=scottmcm
rustc_public: Remove movability from `RigidTy/AggregateKind::Coroutine`

Part of rust-lang/rust#119174 .
I think we should be good now to sync this change in rustc_public.
2025-07-25 11:16:39 +02:00
Matthias Krüger
d64e48bcf0
Rollup merge of #144390 - oli-obk:arbitrary-enum-discrs, r=SparrowLii
Remove dead code and extend test coverage and diagnostics around it

I was staring a bit at the `dont_niche_optimize_enum` variable and figured out that part of it is dead code (at least today it is). I changed the diagnostic and test around the code that makes that part dead code, so everything that makes removing that code sound is visible in this PR
2025-07-25 11:16:39 +02:00
Matthias Krüger
7c4b2b92c2
Rollup merge of #144200 - estebank:dont-point-at-closure, r=lcnr
Tweak output for non-`Clone` values moved into closures

When we encounter a non-`Clone` value being moved into a closure, try to find the corresponding type of the binding being moved, if it is a `let`-binding or a function parameter. If any of those cases, we point at them with the note explaining that the type is not `Copy`, instead of giving that label to the place where it is captured. When it is a `let`-binding with no explicit type, we point at the initializer (if it fits in a single line).

```
error[E0507]: cannot move out of `foo`, a captured variable in an `Fn` closure
  --> f111.rs:14:25
   |
13 | fn do_stuff(foo: Option<Foo>) {
   |             ---  ----------- move occurs because `foo` has type `Option<Foo>`, which does not implement the `Copy` trait
   |             |
   |             captured outer variable
14 |     require_fn_trait(|| async {
   |                      -- ^^^^^ `foo` is moved here
   |                      |
   |                      captured by this `Fn` closure
15 |         if foo.map_or(false, |f| f.foo()) {
   |            --- variable moved due to use in coroutine
```

instead of

```
error[E0507]: cannot move out of `foo`, a captured variable in an `Fn` closure
  --> f111.rs:14:25
   |
13 | fn do_stuff(foo: Option<Foo>) {
   |             --- captured outer variable
14 |     require_fn_trait(|| async {
   |                      -- ^^^^^ `foo` is moved here
   |                      |
   |                      captured by this `Fn` closure
15 |         if foo.map_or(false, |f| f.foo()) {
   |            ---
   |            |
   |            variable moved due to use in coroutine
   |            move occurs because `foo` has type `Option<Foo>`, which does not implement the `Copy` trait
```
2025-07-25 11:16:36 +02:00
Matthias Krüger
ba2c337025
Rollup merge of #143979 - dpaoliello:arm64ectest, r=petrochenkov
Test fixes for Arm64EC Windows

* `tests/ui/cfg/conditional-compile-arch.rs` needs an Arm64EC case.
* `tests/ui/runtime/backtrace-debuginfo.rs` should skip Arm64EC as it suffers from the same truncated backtraces as Arm64 Windows.
* `tests/ui/linkage-attr/incompatible-flavor.rs` is a general issue: it assumes that the Rust compiler is always built with the x86 target enabled in the backend, but I only enabled AArch64 when building locally to speed up the LLVM compilation.
2025-07-25 11:16:35 +02:00
Matthias Krüger
89a1b7dbb7
Rollup merge of #143970 - SunkenPotato:update_mem_copy_docs, r=scottmcm
Update core::mem::copy documentation

Update the documentation of `core::mem::copy` to include a `const` on the definition of the function.
2025-07-25 11:16:34 +02:00
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
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
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