Commit Graph

300840 Commits

Author SHA1 Message Date
Guillaume Gomez
a27f3e3fd1 Rename tests/codegen into tests/codegen-llvm 2025-07-22 14:28:48 +02:00
Guillaume Gomez
ed93c1783b Rename tests/assembly into tests/assembly-llvm 2025-07-22 14:27:48 +02:00
bors
c0b282f0cc 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
bors
9748d87dc7 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)
6628a4afb5 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)
43fa3f555e 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)
55a477efb2 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)
05f80f7817 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)
551cef9fc9 Rollup merge of #144212 - bjorn3:remove_unique_lang_item, r=oli-obk
Remove the ptr_unique lang item

Miri no longer uses it since https://github.com/rust-lang/miri/pull/4307.
2025-07-22 00:54:30 +08:00
许杰友 Jieyou Xu (Joe)
9e9399fcf8 Rollup merge of #144187 - RalfJung:type-id-base-addr, r=oli-obk
fix handling of base address for TypeId allocations

This fixes the problems discovered by ````@theemathas```` in https://github.com/rust-lang/rust/pull/142789:
- const-eval would sometimes consider TypeId pointers to be null
- the type ID is different in Miri than in regular executions

Both boil down to the same issue: the TypeId "allocation" has a guaranteed 0 base address, but const-eval assumes it was non-zero (like normal allocations) and Miri randomized it (like normal allocations).

r? ````@oli-obk````
2025-07-22 00:54:30 +08:00
许杰友 Jieyou Xu (Joe)
0fd009ffe4 Rollup merge of #144176 - Kobzol:bors-labels-blocking, r=oli-obk
Add approval blocking labels for new bors

If a PR contains these labels, new bors won't let anyone approve it. We don't merge PRs using new bors yet, ofc, but I wanted to prepare this so that I don't forget about it.

This was proposed here: [#t-lang/meetings > Triage meeting 2025-07-23 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/410673-t-lang.2Fmeetings/topic/Triage.20meeting.202025-07-23/near/529407150) and implemented [here](https://github.com/rust-lang/bors/pull/367).

CC ````@RalfJung````

r? ````@oli-obk````
2025-07-22 00:54:29 +08:00
许杰友 Jieyou Xu (Joe)
ef4a7fb1b7 Rollup merge of #144080 - jieyouxu:realign, r=BoxyUwU
Mitigate `#[align]` name resolution ambiguity regression with a rename

Mitigates beta regression rust-lang/rust#143834 after a beta backport.

### Background on the beta regression

The name resolution regression arises due to rust-lang/rust#142507 adding a new feature-gated built-in attribute named `#[align]`. However, unfortunately even [introducing new feature-gated unstable built-in attributes can break user code](https://www.github.com/rust-lang/rust/issues/134963) such as

```rs
macro_rules! align {
    () => {
        /* .. */
    };
}

pub(crate) use align; // `use` here becomes ambiguous
```

### Mitigation approach

This PR renames `#[align]` to `#[rustc_align]` to mitigate the beta regression by:

1. Undoing the introduction of a new built-in attribute with a common name, i.e. `#[align]`.
2. Renaming `#[align]` to `#[rustc_align]`. The renamed attribute being `rustc_align` will not introduce new stable breakages, as attributes beginning with `rustc` are reserved and perma-unstable. This does mean existing nightly code using `fn_align` feature will additionally need to specify `#![feature(rustc_attrs)]`.

This PR is very much a short-term mitigation to alleviate time pressure from having to fully fix the current limitation of inevitable name resolution regressions that would arise from adding any built-in attributes. Long-term solutions are discussed in [#t-lang > namespacing macro attrs to reduce conflicts with new adds](https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/namespacing.20macro.20attrs.20to.20reduce.20conflicts.20with.20new.20adds/with/529249622).

### Alternative mitigation options

[Various mitigation options were considered during the compiler triage meeting](https://github.com/rust-lang/rust/issues/143834#issuecomment-3084415277), and those consideration are partly reproduced here:

- Reverting the PR doesn't seem very minimal/trivial, and carries risks of its own.
- Rename to a less-common but aim-to-stabilization name is itself not safe nor convenient, because (1) that risks introducing new regressions (i.e. ambiguity against the new name), and (2) lang would have to FCP the new name hastily for the mitigation to land timely and have a chance to be backported. This also makes the path towards stabilization annoying.
- Rename the attribute to a rustc attribute, which will be perma-unstable and does not cause new ambiguities in stable code.
    - This alleviates the time pressure to address *this* regression, or for lang to have to rush an FCP for some new name that can still break user code.
    - This avoids backing out a whole implementation.

### Review advice

This PR is best reviewed commit-by-commit.

- Commit 1 adds a test `tests/ui/attributes/fn-align-nameres-ambiguity-143834.rs` which demonstrates the current name resolution regression re. `align`. This test fails against current master.
- Commit 2 carries out the renames and test reblesses. Notably, commit 2 will cause `tests/ui/attributes/fn-align-nameres-ambiguity-143834.rs` to change from fail (nameres regression) to pass.

This PR, if the approach still seems acceptable, will need a beta-backport to address the beta regression.
2025-07-22 00:54:28 +08:00
许杰友 Jieyou Xu (Joe)
a3ab807694 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
许杰友 Jieyou Xu (Joe)
2e0748b185 Rollup merge of #143985 - makai410:rp-rename, r=oli-obk
rustc_public: de-StableMIR-ize

This PR updates relevant docs about StableMIR, basically just rewording StableMIR/SMIR to rustc_public/rustc_public's IR.

The README.md in the `rustc_public` crate is out-dated. I plan to rewrite it after we fork rustc_public into its own repository.

This PR doesn't change the fact that we still use `-Z unpretty=stable-mir` as a rustc parameter for printing the IR, since I feel it's a bit verbose and weird if we use `-Z unpretty=rustc-public-ir`. I was wondering if we can have a short and easy alias for rustc_public's IR.
2025-07-22 00:54:27 +08:00
许杰友 Jieyou Xu (Joe)
38efe3875a Rollup merge of #143816 - Kobzol:compiletest-check-macro, r=jieyouxu
Implement `check` for compiletest and RA using tool macro

Small cleanup to reduce the number of places that require custom check steps. Of course I had to include one mini hack because of Rust Analyzer.. but I think it's worth it here.

r? ````@jieyouxu````
2025-07-22 00:54:26 +08:00
许杰友 Jieyou Xu (Joe)
1f8b531b54 Rollup merge of #143768 - Randl:const-try, r=oli-obk
Constify Try, From, TryFrom and relevant traits
2025-07-22 00:54:26 +08:00
许杰友 Jieyou Xu (Joe)
a99f3af990 Rollup merge of #143430 - cjgillot:extra-lifetime-swap, r=oli-obk
Lower extra lifetimes before normal generic params.

Fixes https://github.com/rust-lang/rust/issues/143413
2025-07-22 00:54:25 +08:00
许杰友 Jieyou Xu (Joe)
5e3eb25125 Rollup merge of #142097 - ZuseZ4:offload-host1, r=oli-obk
gpu offload host code generation

r? ghost

This will generate most of the host side code to use llvm's offload feature.
The first PR will only handle automatic mem-transfers to and from the device.
So if a user calls a kernel, we will copy inputs back and forth, but we won't do the actual kernel launch.
Before merging, we will use LLVM's Info infrastructure to verify that the memcopies match what openmp offloa generates in C++. `LIBOMPTARGET_INFO=-1 ./my_rust_binary` should print that a memcpy to and later from the device is happening.

A follow-up PR will generate the actual device-side kernel which will then do computations on the GPU.
A third PR will implement manual host2device and device2host functionality, but the goal is to minimize cases where a user has to overwrite our default handling due to performance issues.

I'm trying to get a full MVP out first, so this just recognizes GPU functions based on magic names. The final frontend will obviously move this over to use proper macros, like I'm already doing it for the autodiff work.
This work will also be compatible with std::autodiff, so one can differentiate GPU kernels.

Tracking:
- https://github.com/rust-lang/rust/issues/131513
2025-07-22 00:54:24 +08:00
Maksim Bondarenkov
c193f3039f 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
2025-07-21 15:47:37 +03:00
bors
3f9f20f71d Auto merge of #144154 - tgross35:update-builtins, r=tgross35
compiler-builtins subtree update

Subtree update of `compiler-builtins` to 2cdde03950.

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

Fixes: https://github.com/rust-lang/rust/issues/144076

r? `@ghost`
2025-07-21 12:47:33 +00:00
Evgenii Zheltonozhskii
3c76e3d002 Constify Try, From, TryFrom 2025-07-21 12:49:45 +03:00
Tshepang Mbambo
62e3a05291 Merge pull request #2512 from rust-lang/rustc-pull
Rustc pull update
2025-07-21 11:16:20 +02:00
Jieyou Xu
74ba9cbae4 Don't use another main test file as auxiliary
In this case, the exact extern crate isn't very important.

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.
2025-07-21 16:58:54 +08:00
Tshepang Mbambo
4a45ab5ad4 Merge pull request #2513 from rust-lang/tshepang/typos
fix some typos
2025-07-21 10:50:11 +02:00
Tshepang Mbambo
79e3c7df0b fix some typos 2025-07-21 10:53:11 +02:00
bors
67819923ac Auto merge of #144238 - jhpratt:rollup-xb8aida, r=jhpratt
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#144144 (tests: Skip supported-crate-types test on musl hosts)
 - rust-lang/rust#144159 (opt-dist: change build_dir field to be an actual build dir)
 - rust-lang/rust#144162 (Debug impls for DropElaborators)
 - rust-lang/rust#144189 (Add non-regression test for rust-lang/rust#144168)
 - rust-lang/rust#144216 (Don't consider unstable fields always-inhabited)
 - rust-lang/rust#144229 (Miri subtree update)
 - rust-lang/rust#144230 (Option::as_slice: fix comment)
 - rust-lang/rust#144235 (Fix run-make tests on musl hosts)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-21 08:42:52 +00:00
bjorn3
1fd06975d0 Remove Retag for Unique 2025-07-21 08:08:41 +00:00
Laurențiu Nicola
8f67bcf4b0 Merge pull request #20268 from lnicola/sync-from-rust
minor: Sync from downstream
2025-07-21 06:58:10 +00:00
Laurențiu Nicola
da90db796d Downgrade ra-ap-rustc_parse_format 2025-07-21 09:46:53 +03:00
Laurențiu Nicola
2050358679 Revert "Bump rustc-literal-escaper"
This reverts commit 9f3adc540b51a4c2d0472d94033f6d9147b36f6e.
2025-07-21 09:31:28 +03:00
Laurențiu Nicola
f2633640d6 Bump rustc-literal-escaper 2025-07-21 09:27:37 +03:00
Laurențiu Nicola
1482809fc1 Bump rustc crates 2025-07-21 09:19:24 +03:00
Laurențiu Nicola
2f14119240 Merge from rust-lang/rust 2025-07-21 09:18:22 +03:00
Laurențiu Nicola
750c1e9c39 Preparing for merge from rust-lang/rust 2025-07-21 09:17:54 +03:00
Shoyu Vanilla (Flint)
4bbe74bb6c Merge pull request #20256 from A4-Tacks/gen-mut-trait-deref
Add Deref -> DerefMut for generate_mut_trait_impl
2025-07-21 04:31:24 +00:00
Shoyu Vanilla (Flint)
33d62b5fba Merge pull request #20262 from ChayimFriedman2/goto-ref-raw
fix: Fix search of raw labels and lifetimes
2025-07-21 04:30:42 +00:00
The rustc-josh-sync Cronjob Bot
ad20b064c3 Merge ref '460259d14de0' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: 460259d14d
Filtered ref: 599ee17eb87c83f97eb37fd9fe264da65d4c9461

This merge was created using https://github.com/rust-lang/josh-sync.
2025-07-21 04:17:50 +00:00
The rustc-josh-sync Cronjob Bot
897d007f8f Prepare for merging from rust-lang/rust
This updates the rust-version file to 460259d14d.
2025-07-21 04:17:44 +00:00
Jacob Pratt
f0da6e2990 Rollup merge of #144235 - Gelbpunkt:run-make-musl, r=jieyouxu
Fix run-make tests on musl hosts

On musl hosts, we already set `-Ctarget-feature=-crt-static` and `IS_MUSL_HOST=1` in compiletest. However, in order for the run-make tests to compile fine on musl hosts, we need to propagate this flag in our rustc invocations to ensure we can generate cdylibs.
2025-07-20 23:11:24 -04:00
Jacob Pratt
95d9c8dfcb Rollup merge of #144230 - RalfJung:option-as-slice-comment-fix, r=scottmcm
Option::as_slice: fix comment

The implementation got changed in https://github.com/rust-lang/rust/pull/117525 without updating the comment. Now the comment makes no sense any more since there is no intrinsic that returns a pointer in this function any more.

(It is also very strange to say "in the new version" in a comment -- what is that supposed to tell someone reading the code 2 years later? That wording was introduced even earlier, in https://github.com/rust-lang/rust/pull/109179.)

Cc `@GKFX` `@petrochenkov` `@llogiq` `@scottmcm`
2025-07-20 23:11:23 -04:00
Jacob Pratt
b9701de4b1 Rollup merge of #144229 - RalfJung:miri-sync, r=RalfJung
Miri subtree update

r? `@ghost`
2025-07-20 23:11:23 -04:00
Jacob Pratt
830b8237de Rollup merge of #144216 - Nadrieril:revert-pin-hack, r=compiler-errors
Don't consider unstable fields always-inhabited

This reverts the hack in https://github.com/rust-lang/rust/pull/133889 now that `Pin`'s field is no longer public.

Fixes https://github.com/rust-lang/rust/issues/143468.

r? ```@compiler-errors```
2025-07-20 23:11:22 -04:00
Jacob Pratt
b81b2a7ecf Rollup merge of #144189 - lqd:test-144168, r=petrochenkov
Add non-regression test for #144168

This is a non-regression test for issue rust-lang/rust#144168, reduced from `zerocopy`, to go with https://github.com/rust-lang/rust/pull/144172 since it had no test yet, and we didn't want to delay it from landing.

Closes rust-lang/rust#144168

I've checked that the test does fail without rust-lang/rust#144172.
2025-07-20 23:11:21 -04:00
Jacob Pratt
7d0c7b2dcf Rollup merge of #144162 - beepster4096:drop_elaborator_debug_impls, r=compiler-errors
Debug impls for DropElaborators

It's a little weird that these just have a completely empty Debug impl. Now they're `ElaborateDropsCtxt { .. }` and `DropShimElaborator { .. }`.
2025-07-20 23:11:21 -04:00
Jacob Pratt
a275a5fb22 Rollup merge of #144159 - ognevny:opt-dist-build-dir, r=Kobzol
opt-dist: change build_dir field to be an actual build dir

make it configurable so users can set build.build-dir option in bootstrap.toml

r? Kobzol

try-job: dist-x86_64-msvc
try-job: dist-x86_64-linux
2025-07-20 23:11:20 -04:00
Jacob Pratt
9fdfaef403 Rollup merge of #144144 - Gelbpunkt:musl-crate-types-test, r=compiler-errors
tests: Skip supported-crate-types test on musl hosts

This test depends on the target-specific default of crt-static for musl targets. However, running the testsuite on a musl host requires setting `crt-static` to `false`, as it wouldn't otherwise be possible to build rustc. This in turn will enable `-Ctarget-feature=-crt-static` for all tests, mismatching the expected `+crt-static` for the musl target tested in this testcase.

Since this test specifically tests the default value of `crt-static` for the musl target, ignoring it entirely makes more sense than manually setting `-Ctarget-feature=+crt-static` here, but both would be valid approaches.
2025-07-20 23:11:20 -04:00
bors
e05ab47e6c Auto merge of #143833 - scottmcm:final-mcp-838, r=compiler-errors
Ban projecting into SIMD types [MCP838]

Closes https://github.com/rust-lang/compiler-team/issues/838

The actual compiler change here is tiny; there's just a bazillion tests to update.

~~Since I'm sure I've missed some, for now~~
~~r ghost~~

try-job: test-various
try-job: x86_64-gnu-nopt
2025-07-21 02:31:56 +00:00
Jens Reidel
a546a7cb25 Fix run-make tests on musl hosts
On musl hosts, we already set -Ctarget-feature=-crt-static and
IS_MUSL_HOST=1 in compiletest. However, in order for the run-make tests
to compile fine on musl hosts, we need to propagate this flag in our
rustc invocations to ensure we can generate cdylibs.

Signed-off-by: Jens Reidel <adrian@travitia.xyz>
2025-07-21 02:14:01 +02:00
bors
460259d14d Auto merge of #143309 - compiler-errors:param-sized-fast-path, r=lcnr
Consider param-env for sizedness fast path

Look up `T: Sized` in param-env if `T` is a param or placeholder (the latter is for use in the new solver).
2025-07-20 21:29:18 +00:00
Ralf Jung
192efbbd20 clippy: make tests work in stage 1 2025-07-20 22:55:15 +02:00