Commit graph

286669 commits

Author SHA1 Message Date
est31
5258cb76a5 Don't call ungate_last 2025-04-20 23:14:55 +02:00
est31
162daaa2fa Remove let_chains feature gate from even more tests 2025-04-18 15:57:29 +02:00
est31
d75f8cde2f Also allow let chains in match guards 2025-04-18 15:57:29 +02:00
est31
eb1639bd33 Add tests to check the situation with heterogenous spans
The edition gate is a bit stricter than the drop behaviour,
which is fine. The cases we want to avoid are the opposite:
not gated but 2021 drop behaviour.
2025-04-18 15:57:29 +02:00
est31
0e91190b05 Remove let_chains feature gate from some places in the testsuite 2025-04-18 15:57:29 +02:00
est31
2e61af2fca Stabilize let chains on edition 2024 2025-04-18 14:21:14 +02:00
bors
1f76d219c9 Auto merge of #139992 - matthiaskrgr:rollup-ak3uibu, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #139351 (Autodiff batching2)
 - #139483 (f*::NAN: guarantee that this is a quiet NaN)
 - #139498 (Ignore zero-sized types in wasm future-compat warning)
 - #139967 (Introduce and use specialized `//@ ignore-auxiliary` for test support files instead of using `//@ ignore-test`)
 - #139969 (update libc)
 - #139971 (Make C string merging test work on MIPS)
 - #139974 (Change `InterpCx::instantiate*` function visibility to pub)
 - #139977 (Fix drop handling in `hint::select_unpredictable`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-17 21:30:51 +00:00
Matthias Krüger
dc2d273acd
Rollup merge of #139977 - Amanieu:select_unpredictable_drop, r=RalfJung
Fix drop handling in `hint::select_unpredictable`

This intrinsic doesn't drop the value that is not selected so this is manually done in the public function that wraps the intrinsic.
2025-04-17 21:53:27 +02:00
Matthias Krüger
e5ba69b927
Rollup merge of #139974 - Patrick-6:change-visibility, r=RalfJung
Change `InterpCx::instantiate*` function visibility to pub

For some ongoing work in Miri we need to be able to access `instantiate_from_current_frame_and_normalize_erasing_regions` and `instantiate_from_frame_and_normalize_erasing_regions` on `InterpCx`.

r? `@RalfJung`
2025-04-17 21:53:27 +02:00
Matthias Krüger
18f6c595ee
Rollup merge of #139971 - LukasWoodtli:gardena/lw/fix-cstring-merging-test, r=wesleywiser
Make C string merging test work on MIPS

Assembly for MIPS uses, by convention, a different prefix for local anonymous variables.
2025-04-17 21:53:26 +02:00
Matthias Krüger
4c92186f21
Rollup merge of #139969 - psumbera:libc-rust-analyzer, r=lnicola
update libc

This is needed for https://github.com/rust-lang/rust/pull/138699#discussion_r2048603474
2025-04-17 21:53:26 +02:00
Matthias Krüger
026d56b0f6
Rollup merge of #139967 - jieyouxu:auxiliary, r=wesleywiser
Introduce and use specialized `//@ ignore-auxiliary` for test support files instead of using `//@ ignore-test`

### Summary

Add a semantically meaningful directive for ignoring test *auxiliary* files. This is for auxiliary files that *participate* in actual tests but should not be built by `compiletest` (i.e. these files are involved through `mod xxx;` or `include!()` or `#[path = "xxx"]`, etc.).

### Motivation

A specialized directive like `//@ ignore-auxiliary` makes it way easier to audit disabled tests via `//@ ignore-test`.
  - These support files cannot use the canonical `auxiliary/` dir because they participate in module resolution or are included, or their relative paths can be important for test intention otherwise.

Follow-up to:
- #139705
- #139783
- #139740

See also discussions in:

- [#t-compiler > Directive name for non-test aux files?](512773817)
- [#t-compiler > Handling disabled `//@ ignore-test` tests](512005974)
- [#t-compiler/meetings > [steering] 2025-04-11 Dealing with disabled tests](511717981)

### Remarks on remaining unconditionally disabled tests under `tests/`

After this PR, against commit 79a272c640, only **14** remaining test files are disabled through `//@ ignore-test`:

<details>
<summary>Remaining `//@ ignore-test` files under `tests/`</summary>

```
tests/debuginfo/drop-locations.rs
4://@ ignore-test (broken, see #128971)

tests/rustdoc/macro-document-private-duplicate.rs
1://@ ignore-test (fails spuriously, see issue #89228)

tests/rustdoc/inline_cross/assoc-const-equality.rs
3://@ ignore-test (FIXME: #125092)

tests/ui/match/issue-27021.rs
7://@ ignore-test (#54987)

tests/ui/match/issue-26996.rs
7://@ ignore-test (#54987)

tests/ui/issues/issue-49298.rs
9://@ ignore-test (#54987)

tests/ui/issues/issue-59756.rs
2://@ ignore-test (rustfix needs multiple suggestions)

tests/ui/precondition-checks/write.rs
5://@ ignore-test (unimplemented)

tests/ui/precondition-checks/read.rs
5://@ ignore-test (unimplemented)

tests/ui/precondition-checks/write_bytes.rs
5://@ ignore-test (unimplemented)

tests/ui/explicit-tail-calls/drop-order.rs
2://@ ignore-test: tail calls are not implemented in rustc_codegen_ssa yet, so this causes 🧊

tests/ui/panics/panic-short-backtrace-windows-x86_64.rs
3://@ ignore-test (#92000)

tests/ui/json/json-bom-plus-crlf-multifile-aux.rs
3://@ ignore-test Not a test. Used by other tests

tests/ui/traits/next-solver/object-soundness-requires-generalization.rs
2://@ ignore-test (see #114196)
```
</details>

Of these, most are either **unimplemented**, or **spurious**, or **known-broken**. The outstanding one is `tests/ui/json/json-bom-plus-crlf-multifile-aux.rs` which I did not want to touch in *this* PR -- that aux file has load-bearing BOM and carriage returns and byte offset matters. I think those test files that require special encoding / BOM probably are better off as `run-make` tests. See #139968 for that aux file.

### Review advice

- Best reviewed commit-by-commit.
- The directive name diverged from the most voted `//@ auxiliary` because I think that's easy to confuse with `//@ aux-{crate,dir}`.

r? compiler
2025-04-17 21:53:25 +02:00
Matthias Krüger
8b7a2897c8
Rollup merge of #139498 - alexcrichton:wasm-zst-safe, r=wesleywiser
Ignore zero-sized types in wasm future-compat warning

This commit fixes a false positive of the warning triggered for #138762 and the fix is to codify that zero-sized types are "safe" in both the old and new ABIs.
2025-04-17 21:53:24 +02:00
Matthias Krüger
b6e48d3850
Rollup merge of #139483 - RalfJung:nan, r=tgross35
f*::NAN: guarantee that this is a quiet NaN

I think we should guarantee that this is a quiet NaN. This then implies that programs not using `f*::from_bits` (or unsafe type conversions) are guaranteed to only work with quiet NaNs. It would be awkward if people start to write `0.0 / 0.0` instead of using the constant just because they want to get a guaranteed-quiet NaN.

This is a `@rust-lang/libs-api` change. The definition of this constant currently is `0.0 / 0.0`, which is already guaranteed to be a quiet NaN. So all this does is forward that guarantee to our users.
2025-04-17 21:53:24 +02:00
Matthias Krüger
87a163523f
Rollup merge of #139351 - EnzymeAD:autodiff-batching2, r=oli-obk
Autodiff batching2

~I will rebase it once my first PR landed.~ done.
This autodiff batch mode is more similar to scalar autodiff, since it still only takes one shadow argument.
However, that argument is supposed to be `width` times larger.

r? `@oli-obk`

Tracking:

- https://github.com/rust-lang/rust/issues/124509
2025-04-17 21:53:23 +02:00
bors
a15cce2690 Auto merge of #139979 - matthiaskrgr:rollup-7wu5169, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #139774 (Fix replacing supertrait aliases in `ReplaceProjectionWith`)
 - #139850 (Hide unstable print kinds within emit_unknown_print_request_help in stable channel)
 - #139870 (add retries to remove and create dir all)
 - #139902 (do not emit `OpaqueCast` projections with `-Znext-solver`)
 - #139931 (bootstrap: enable zlib for LLVM for Windows GNU)
 - #139935 (Upgrade to `rustc-rayon-core` 0.5.1)
 - #139943 (rustdoc: Support inlined cross-crate re-exported trait aliases)
 - #139961 (Two `rustc_const_eval` cleanups)
 - #139962 (opt-dist: add a flag for running tests)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-17 16:33:06 +00:00
Matthias Krüger
6922524035
Rollup merge of #139962 - ognevny:opt-dist-tests, r=Kobzol
opt-dist: add a flag for running tests

when using `opt-dist local` user probably won't need to run tests (for various reasons). currently the only way to disable them is to set `TRY_DIST_BUILD=1`, which is not obvious and can be bad for non-CI envronments (as I guess)

possibly the `run_tests` name can be confusing too...

r? Kobzol

try-job: dist-x86_64-linux
try-job: dist-x86_64-msvc
2025-04-17 17:40:31 +02:00
Matthias Krüger
8281a54a1b
Rollup merge of #139961 - nnethercote:two-rustc_const_eval-cleanups, r=oli-obk
Two `rustc_const_eval` cleanups

r? ``@lcnr``
2025-04-17 17:40:31 +02:00
Matthias Krüger
7a4525c883
Rollup merge of #139943 - fmease:rustdoc-ixcre-trait-aliases, r=GuillaumeGomez
rustdoc: Support inlined cross-crate re-exported trait aliases

Previously we'd just drop them. As a result of this PR, [`core::ptr::Thin`](https://doc.rust-lang.org/nightly/core/ptr/traitalias.Thin.html) will be admitted into the `std` façade!

Also, render the where clause *after* the bounds / the `=`, not before them, as it should be.

r? rustdoc
2025-04-17 17:40:30 +02:00
Matthias Krüger
b79996d97d
Rollup merge of #139935 - cuviper:rustc-rayon-core-0.5.1, r=lqd
Upgrade to `rustc-rayon-core` 0.5.1

* [Fix a race with deadlock detection](https://github.com/rust-lang/rustc-rayon/pull/15)
* [Cherry-pick changes from upstream rayon-core](https://github.com/rust-lang/rustc-rayon/pull/16)
  - This also removes a few dependencies from rustc's tidy list.
2025-04-17 17:40:30 +02:00
Matthias Krüger
dce750644f
Rollup merge of #139931 - ognevny:bootstrap-llvm-zlib, r=Kobzol
bootstrap: enable zlib for LLVM for Windows GNU

when compiling target LLVM with `opt-dist local` on Windows/MinGW, profraw files are being compressed with zlib, so compiling without it will make `llvm-profdata` complain about lacking of zlib support. this error is shown:

`profile uses zlib compression but the profile reader was built without zlib support`

example from llvm test suite: 76b5fcbf97/llvm/test/tools/llvm-profdata/nocompress.test (L15).

implementation of step 3. from 512393873

r? Kobzol
2025-04-17 17:40:29 +02:00
Matthias Krüger
67e2358fbb
Rollup merge of #139902 - lcnr:no-opaque-cast-projection, r=oli-obk
do not emit `OpaqueCast` projections with `-Znext-solver`

We normalize opaque types in their defining scope if the new solver is enabled. This means projections do not contain any 'revealable' opaque types we need to worry about. We either have a type which has been normalized by writeback or we need to normalize it anyways.

r? ```@compiler-errors``` ```@oli-obk```
2025-04-17 17:40:28 +02:00
Matthias Krüger
cecc7a490a
Rollup merge of #139870 - Shourya742:2025-04-15-add-retries-to-remove_and_create_dir_all, r=jieyouxu
add retries to remove and create dir all

closes: #139230

r? ```@jieyouxu```
2025-04-17 17:40:28 +02:00
Matthias Krüger
d2db1c1df9
Rollup merge of #139850 - xizheyin:issue-138698, r=jieyouxu
Hide unstable print kinds within emit_unknown_print_request_help in stable channel

Fixes #138698

We need to get the channel from `matches`. However, since `matches`(Line 1169) is constructed after `rustc_optgroups` (Line1165, where `RustcOptGroup::value_hint` is generated, i.e. what `rustc --print print` prints), I've left it unchanged here for now.

2da29dbe8f/compiler/rustc_driver_impl/src/lib.rs (L1161-L1169)

There is actually a way to manually parse the `--crate-name` parameter, but I'm afraid that's an unorthodox practice. So I conservatively just modified `emit_unknown_print_request_help` to print different parameters depending on whether they are nightly or not when passing the error parameter.

r? ```@jieyouxu```
2025-04-17 17:40:27 +02:00
Matthias Krüger
da43826398
Rollup merge of #139774 - compiler-errors:supertrait-alias, r=lcnr
Fix replacing supertrait aliases in `ReplaceProjectionWith`

The new solver has a procedure called `predicates_for_object_candidate`, which elaborates the super-bounds and item-bounds that are required to hold for a dyn trait to implement something via a built-in object impl.

In that procedure, there is a folder called `ReplaceProjectionWith` which is responsible for replacing projections that reference `Self`, so that we don't encounter cycles when we then go on to normalize those projections in the process of proving these super-bounds.

That folder had a few problems: Firstly, it wasn't actually checking that this was a super bound originating from `Self`. Secondly, it only accounted for a *single* projection type def id, but trait objects can have multiple (i.e. `trait Foo<A, B>: Bar<A, Assoc = A> + Bar<B, Assoc = B>`).

To fix the first, it's simple enough to just add an equality check for the self ty. To fix the second, I implemented a matching step that's very similar to the `projection_may_match` check we have for upcasting, since on top of having multiple choices, we need to deal with both non-structural matches and ambiguity.

This probably lacks a bit of documentation, but I think it works pretty well.

Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/171

r? lcnr
2025-04-17 17:40:27 +02:00
Amanieu d'Antras
e5e5fb9d80 Fix drop handling in hint::select_unpredictable
This intrinsic doesn't drop the value that is not selected so this is
manually done in the public function that wraps the intrinsic.
2025-04-17 17:30:53 +02:00
Alex Crichton
f9091e24a0 Ignore zero-sized types in wasm future-compat warning
This commit fixes a false positive of the warning triggered for #138762
and the fix is to codify that zero-sized types are "safe" in both the
old and new ABIs.
2025-04-17 07:42:55 -07:00
Patrick-6
50cf102311 Change function visibility to pub 2025-04-17 16:23:44 +02:00
Lukas Woodtli
7a5a884275 Make C string merging test work on MIPS
Assembly for MIPS uses, by convention, a different prefix for local
anonymous variables.
2025-04-17 16:08:22 +02:00
xizheyin
8562110e0d Hide unstable print kinds within emit_unknown_print_request_help in stable channel
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-04-17 22:02:31 +08:00
Jieyou Xu
6c5a481f93
tests: remove unused auxiliaries under tests/ui/directory_ownership/ 2025-04-17 19:45:28 +08:00
Jieyou Xu
89cac55bb8
tests: use //@ ignore-auxiliary with backlinked primary test file 2025-04-17 19:45:28 +08:00
petr sumbera - Sun Microsystems - Prague Czech Republic
35a4140723 update libc 2025-04-17 13:39:46 +02:00
bors
883f9f72e8 Auto merge of #139949 - matthiaskrgr:rollup-pxc5tsx, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #138632 (Stabilize `cfg_boolean_literals`)
 - #139416 (unstable book; document `macro_metavar_expr_concat`)
 - #139782 (Consistent with treating Ctor Call as Struct in liveness analysis)
 - #139885 (document RUSTC_BOOTSTRAP, RUSTC_OVERRIDE_VERSION_STRING, and -Z allow-features in the unstable book)
 - #139904 (Explicitly annotate edition for `unpretty=expanded` and `unpretty=hir` tests)
 - #139932 (transmutability: Refactor tests for simplicity)
 - #139944 (Move eager translation to a method on Diag)
 - #139948 (git: ignore `60600a6fa4` for blame purposes)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-17 11:21:54 +00:00
Jieyou Xu
6bbee334fd
rustc-dev-guide: document //@ ignore-auxiliary 2025-04-17 18:52:57 +08:00
Jieyou Xu
d1178faa93
tests: refine disable reason for tests/debuginfo/drop-locations.rs 2025-04-17 18:52:57 +08:00
Jieyou Xu
d20f848478
compiletest: add specific //@ ignore-auxiliary for test support files
This is for files that *participate* in actual tests but should not be
built by `compiletest` (i.e. these files are involved through `mod xxx;`
or `include!()` or `#[path = "xxx"]`, etc.).

A specialized directive like `//@ ignore-auxiliary` makes it way easier
to audit disabled tests via `//@ ignore-test`.
2025-04-17 18:52:56 +08:00
lcnr
c85b5fcd07 check OpaqueCast tests with next-solver 2025-04-17 12:41:20 +02:00
lcnr
289a23e0e2 do not emit OpaqueCast projections with -Znext-solver 2025-04-17 12:15:04 +02:00
Maksim Bondarenkov
62a104d99e opt-dist: add a flag for running tests
when using `opt-dist local` user probably won't need to run tests (for
various reasons). currently the only way to disable them is to set
`TRY_DIST_BUILD=1`, which is not obvious and can be bad for non-CI
envronments (as I guess)
2025-04-17 13:01:22 +03:00
Maksim Bondarenkov
bf2696311b bootstrap: enable zlib for LLVM when we compile it for profiling
when compiling target LLVM with `opt-dist local` on Windows/MinGW,
profraw files are being compressed with zlib, so compiling without it
will make `llvm-profdata` complain about lacking of zlib support. this
error is shown:

`profile uses zlib compression but the profile reader was built without
zlib support`

example from llvm test suite: 76b5fcbf97/llvm/test/tools/llvm-profdata/nocompress.test (L15)
2025-04-17 12:53:17 +03:00
bors
94015d3cd4 Auto merge of #139926 - weihanglo:update-cargo, r=weihanglo
Update cargo

4 commits in 864f74d4eadcaea3eeda37a2e7f4d34de233d51e..d811228b14ae2707323f37346aee3f4147e247e6
2025-04-11 20:37:27 +0000 to 2025-04-15 15:18:42 +0000
- use `zlib-rs` for gzip compression in rust code (rust-lang/cargo#15417)
- test(rustfix): Use `snapbox` for snapshot testing (rust-lang/cargo#15429)
- chore(deps): update rust crate gix to 0.71.0 [security] (rust-lang/cargo#15391)
- Make sure search paths inside OUT_DIR precede external paths (rust-lang/cargo#15221)

Also,

* The license exception of sha1_smol with BSD-3-Clause is no longer needed, as `gix-*` doesn't depend on it.
* Cargo depends on zlib-rs, which is distributed under Zlib license

r? ghost
2025-04-17 08:07:28 +00:00
bors
15c4ccef03 Auto merge of #139940 - matthiaskrgr:rollup-rd4d3fn, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #135340 (Add `explicit_extern_abis` Feature and Enforce Explicit ABIs)
 - #139440 (rustc_target: RISC-V: feature addition batch 2)
 - #139667 (cfi: Remove #[no_sanitize(cfi)] for extern weak functions)
 - #139828 (Don't require rigid alias's trait to hold)
 - #139854 (Improve parse errors for stray lifetimes in type position)
 - #139889 (Clean UI tests 3 of n)
 - #139894 (Fix `opt-dist` CLI flag and make it work without LLD)
 - #139900 (stepping into impls for normalization is unproductive)
 - #139915 (replace some #[rustc_intrinsic] usage with use of the libcore declarations)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-17 04:52:34 +00:00
Matthias Krüger
7650fe95b1
Rollup merge of #139948 - jieyouxu:ignore-breakup-commit, r=onur-ozkan
git: ignore `60600a6fa4` for blame purposes

60600a6fa4 was simply breaking up compiletest's `runtest.rs` and isn't very useful in git blame.

r? `@onur-ozkan`
2025-04-17 06:25:18 +02:00
Matthias Krüger
059b7d07ef
Rollup merge of #139944 - shepmaster:eager-diagnostics, r=nnethercote
Move eager translation to a method on Diag

This will allow us to eagerly translate messages on a top-level diagnostic, such as a `LintDiagnostic`. As a bonus, we can remove the awkward closure passed into Subdiagnostic and make better use of `Into`.

r? `@nnethercote`
2025-04-17 06:25:18 +02:00
Matthias Krüger
a7af610058
Rollup merge of #139932 - joshlf:transmute-simplify-tests, r=jswrenn
transmutability: Refactor tests for simplicity

r? `@jswrenn`
2025-04-17 06:25:18 +02:00
Matthias Krüger
4a83f43e63
Rollup merge of #139904 - ferrocene:lw-wkumpwrytvtp, r=nnethercote,jieyouxu
Explicitly annotate edition for `unpretty=expanded` and `unpretty=hir` tests

These emit prelude imports which means they are always edition dependent and so running them with a different `--edition` will fail.
2025-04-17 06:25:17 +02:00
Matthias Krüger
4e2fc09570
Rollup merge of #139885 - jyn514:doc-rustc-bootstrap, r=Nadrieril
document RUSTC_BOOTSTRAP, RUSTC_OVERRIDE_VERSION_STRING, and -Z allow-features in the unstable book

[rendered](https://github.com/jyn514/rust/blob/doc-rustc-bootstrap/src/doc/unstable-book/src/compiler-flags/rustc-bootstrap.md)
mcp: https://github.com/rust-lang/compiler-team/issues/863
2025-04-17 06:25:17 +02:00
Matthias Krüger
0757d24f71
Rollup merge of #139782 - xizheyin:issue-139627, r=wesleywiser
Consistent with treating Ctor Call as Struct in liveness analysis

Fixes #139627

When `ExprKind::Call` is a `Ctor`, skips the checking of `expr` and only checks the arguments, thus being consistent with `ExprKind::Struct`.

r? compiler
2025-04-17 06:25:16 +02:00
Matthias Krüger
6426050b68
Rollup merge of #139416 - mejrs:metavar, r=tgross35
unstable book; document `macro_metavar_expr_concat`

Rendered:

![image](https://github.com/user-attachments/assets/25c6d1fa-dac4-4c28-869f-e053b9384e59)
![image](https://github.com/user-attachments/assets/caa11e61-6321-4646-bf53-a1d31fca39f4)
![image](https://github.com/user-attachments/assets/52dc788f-1764-4a75-9fc3-e0fdefd30642)
![image](https://github.com/user-attachments/assets/2fd2ba06-b8e3-4341-83ec-0ea686efdde2)

cc `@c410-f3r`
2025-04-17 06:25:15 +02:00