Commit Graph

326279 Commits

Author SHA1 Message Date
Jonathan Brouwer 4d2f9ca08d Rollup merge of #156365 - RalfJung:stream_send_recv_stress, r=nia-e
stream_send_recv_stress tests: wait for threads to finish

These tests currently fail in Miri (when run with nextest) because all they do is spawn a lot of threads that will do stuff, but they don't wait for the threads to actually finish. Miri by default errors when there are background threads lingering when `main` is done (since that can indicate a leak, and since it makes it impossible to check for memory leaks). Miri gives background threads a bit of time to finish when `main` is done, but for these tests that's nowhere near enough since basically the entire test runs after `main` is done.

Outside Miri, this could also still mean that the test doesn't actually run to completion, it might get abort when `main` finishes.

So let's use `thread::scope` to ensure all threads are done before the test is considered done.
2026-05-10 19:05:47 +02:00
Jonathan Brouwer 06ccbc1929 Rollup merge of #156192 - xtqqczze:slice-from-raw-parts, r=Mark-Simulacrum
core: Replace `ptr::slice_from_raw_parts` with `slice::from_raw_parts`
2026-05-10 19:05:47 +02:00
Jonathan Brouwer e2b3f7e375 Rollup merge of #156129 - Zalathar:pass-fail, r=jieyouxu
compiletest: Migrate from `PassMode`/`FailMode` to `PassFailMode`

Every UI test has an explicit or implicit “pass/fail mode” (e.g. `check-fail` or `build-pass`) that was historically stored in two separate optional fields (`pass_mode` and `fail_mode`). That split made it very hard to determine how the respective values were actually produced and consumed, especially in the presence of `--pass=check` on the command-line, or when building auxiliary crates.

This PR replaces the separate fields and enums for pass-mode and fail-mode with a single `PassFailMode` enum and a single `pass_fail_mode` field.

With this new representation, it should hopefully be easier to understand and modify the pass/fail-mode logic.

---

In order to focus on the main migration, I have mostly refrained from subsequent cleanups.

r? jieyouxu
2026-05-10 19:05:46 +02:00
Jonathan Brouwer dd38e55468 Rollup merge of #156387 - RalfJung:fs-error-str, r=ChrisDenton
std fs tests: avoid matching on OS-provided error string

These tests are [ancient](https://github.com/rust-lang/rust/commit/6bfbad937bdf578e35777d079f8dcfab49758041). No idea why there written in this style back then, but today we'd clearly check the `ErrorKind`, not the string.

r? @ChrisDenton
2026-05-10 19:05:45 +02:00
Jonathan Brouwer 5246f6e4bc Rollup merge of #156323 - bjorn3:clif_has_mnemonic, r=wesleywiser
Handle --print=backend-has-mnemonic in cg_clif

And introduce a `has_mnemonic` method on `CodegenBackend` just like `--print=backend-has-zstd`.
2026-05-10 19:05:44 +02:00
Jonathan Brouwer 29961709f1 Rollup merge of #155982 - cijiugechu:gio-ice-repro, r=chenyukang
Fix closure HIR span context mismatch

Ensure span has the closure expression's SyntaxContext.

Closes rust-lang/rust#155724
2026-05-10 19:05:44 +02:00
Jonathan Brouwer 63e70d5583 Rollup merge of #155679 - fmease:rustdoc-reify-emission-types, r=notriddle
rustdoc: Reify emission types

Implements https://github.com/rust-lang/rust/pull/155374#discussion_r3124208232:

Instead of maintaining the hidden assumption or invariant that `opts.emit.is_empty()` actually means "emit default artifacts" (i.e., `[HtmlStaticFiles, HtmlNonStaticFiles]` under output format `html`; "`[???]`" under output format `json`), actually *reify* the list of emission types so the rest of the code doesn't need to keep this in mind.

I'm not sure if you like this. It's a tinge overengineered, maybe, but it's more robust I claim.

This PR also rejects `--emit` when `--output-format doctest -Zunstable-options` is passed since the latter doesn't honor emission types at all (yet).
2026-05-10 19:05:43 +02:00
Jonathan Brouwer 30ec142b97 Rollup merge of #154972 - chorman0773:return_address, r=Mark-Simulacrum
Implement `core::arch::return_address` and tests

Tracking issue: rust-lang/rust#154966

Implements libs-team#768
2026-05-10 19:05:42 +02:00
Jonathan Brouwer 084bc48198 Rollup merge of #156394 - RalfJung:miri, r=RalfJung
miri subtree update

Subtree update of `miri` to https://github.com/rust-lang/miri/commit/f3f1ed1b34320de40d6dfad8f937341be227876d.

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

r? @ghost
2026-05-10 19:05:41 +02:00
Ralf Jung 46d2c71709 Merge pull request #5022 from RalfJung/direct-errno-translation
try_errnum_to_io_error: support all POSIX error codes
2026-05-10 10:34:08 +00:00
Ralf Jung f83b976ec4 try_errnum_to_io_error: support all POSIX error codes 2026-05-10 12:07:58 +02:00
Ralf Jung a0298aa7e5 std fs tests: avoid matching on OS-provided error string 2026-05-10 11:34:21 +02:00
bors 99eed207b4 Auto merge of #156185 - petrochenkov:queffvis, r=mu001999
resolve: Evaluate private visibilities eagerly in eff vis computation

It's cheaper to evaluate them now when `Decl`arations keep their parent modules.
2026-05-10 09:28:26 +00:00
Ralf Jung 1dca18d828 Merge pull request #5020 from RalfJung/locked
./miri install: add --locked by default
2026-05-10 08:32:06 +00:00
Ralf Jung 5b80eda1a0 Merge pull request #5021 from RalfJung/gnu_get_libc_version
add gnu_get_libc_version stub for getaddrinfo error path
2026-05-10 08:29:16 +00:00
Ralf Jung 2c1e114291 ./miri install: add --locked by default 2026-05-10 10:05:15 +02:00
Ralf Jung 6f0005e206 add gnu_get_libc_version stub for getaddrinfo error path 2026-05-10 10:01:43 +02:00
Ralf Jung 498c8509b6 std_miri_test hack is not needed any more 2026-05-10 09:58:09 +02:00
bors d1961bebe0 Auto merge of #156378 - matthiaskrgr:rollup-NO89xfV, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#149362 (Add Command::get_resolved_envs)
 - rust-lang/rust#155705 (Add `str::word_to_titlecase()` to `alloc`)
 - rust-lang/rust#155970 (Add mention of sendfile(2) and splice(2) to fs::copy() documentation.)
 - rust-lang/rust#156006 (Update a bunch of bootstrap dependencies to remove windows-target)
 - rust-lang/rust#156169 (Change `SwitchInt` handling in dataflow analysis.)
 - rust-lang/rust#155188 (Add regression test for issue 144329)
 - rust-lang/rust#155515 (error on empty `export_name`)
 - rust-lang/rust#155817 (validate `#[link_name = "..."]` & `#[link(name = "...")]` parameters)
 - rust-lang/rust#156107 (remove turbofish notation + use None / Some instead of Option:: (in match documentation))
 - rust-lang/rust#156133 (mark some panicking methods around Duration as track_caller)
 - rust-lang/rust#156363 (`rustc_attr_parsing`: add `AcceptContext::expect_string_literal`)
2026-05-10 06:05:52 +00:00
Vadim Petrochenkov cc630bc470 resolve: Evaluate private visibilities eagerly in eff vis computation 2026-05-10 08:06:03 +03:00
Matthias Krüger ddecb76c99 Rollup merge of #156363 - scrabsha:attributes/expect-string-literal, r=JonathanBrouwer
`rustc_attr_parsing`: add `AcceptContext::expect_string_literal`
2026-05-10 03:17:04 +02:00
Matthias Krüger 34018578e2 Rollup merge of #156133 - RalfJung:time-panic-track-caller, r=Mark-Simulacrum
mark some panicking methods around Duration as track_caller

Currently when they panic it looks like this
```
  0.005045   ---- instant_checked_duration_since_nopanic stdout ----
  0.000039
  0.000009   thread 'instant_checked_duration_since_nopanic' (2) panicked at /home/runner/work/miri-test-libstd/miri-test-libstd/rust-src-patched/library/std/src/time.rs:445:33:
  0.000007   overflow when subtracting duration from instant
  0.000006   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
  0.000007   note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect
```
That's pretty useless.

Also fix the panic message while we are at it.
2026-05-10 03:17:03 +02:00
Matthias Krüger 6fffff97dd Rollup merge of #156107 - Cheese-Space:patch-1, r=Mark-Simulacrum
remove turbofish notation + use None / Some instead of Option:: (in match documentation)
2026-05-10 03:17:03 +02:00
Matthias Krüger 99abbd6a01 Rollup merge of #155817 - folkertdev:link-name-null-empty, r=mejrs
validate `#[link_name = "..."]` & `#[link(name = "...")]` parameters

fixes https://github.com/rust-lang/rust/issues/155776
fixes https://github.com/rust-lang/rust/issues/155484

specifically, do not allow NULL bytes and the empty string in `#[link_name = "..."]` and `#[link(name = "...")]`.

Like some of the others I think this formally needs to be looked at by T-lang because these errors would not show up if not linking.

The LLVM erorr on `#[linke_name = "\0"]` is emitted here, it is not e.g. target-specific.

https://github.com/llvm/llvm-project/blob/d593279c0b2891f0b0c8af3f70a1a0383b4ad1b5/llvm/lib/IR/Value.cpp#L336-L342

On `#[link(name = "")]` we already error today. A NULL byte in `#[link(name = "\0")]` is caught by the linker (https://godbolt.org/z/vnz9sYbPs), using `#[link_name = ""]` makes LLVM generate a name (https://godbolt.org/z/1hWEo4cxf) which is not useful and likely to cause linker errors.

r? jdonszelmann
2026-05-10 03:17:02 +02:00
Matthias Krüger 6b93655434 Rollup merge of #155515 - folkertdev:export-name-not-empty, r=jdonszelmann
error on empty `export_name`

fixes https://github.com/rust-lang/rust/issues/155495

Using an empty string as the name makes LLVM make up a name. However this name can be inconsistent between compilation units, which is UB and can cause linking errors, and some parts of LLVM just crash on the empty name (see the linked issue).

As far as we know there is only one valid pattern that could use this, a `#[used]` static that is not referenced by the program at all. That is not UB, but the `export_name` is not required for that to work, just normal rust name mangling would do fine.

Technically this is a breaking change, but it seems unlikely that this actually breaks code in the wild that wasn't already broken. I'll leave it up to T-lang to determine what is required here (crater run, FCW, ...), but my gut feeling is that we could just merge this and nobody would notice.
2026-05-10 03:17:01 +02:00
Matthias Krüger dd0746b15f Rollup merge of #155188 - DaniPopes:144329-test, r=Mark-Simulacrum
Add regression test for issue 144329

Closes https://github.com/rust-lang/rust/issues/144329.
2026-05-10 03:17:01 +02:00
Matthias Krüger 02f733bb48 Rollup merge of #156169 - nnethercote:simplify-SwitchInt-stuff, r=cjgillot
Change `SwitchInt` handling in dataflow analysis.

We call `get_switch_int_data` once for the switch and then pass that data to `apply_switch_int_edge_effect` for each switch target.

The only case in practice is `MaybePlacesSwitchIntData` which does an awkward thing, maintaining an index into the discriminants and updating it on each call to `apply_switch_int_edge_effect`.

This commit changes things to do more work up front in `get_switch_int_data`, in order to then do less work in `apply_switch_int_edge_effect`. This avoids the need for the `variants` and `next_discr` methods and the discriminants index. Overall it's a little simpler.

r? @cjgillot
2026-05-10 03:17:00 +02:00
Matthias Krüger 0711aa94ec Rollup merge of #156006 - bjorn3:bootstrap_no_import_libs, r=Mark-Simulacrum
Update a bunch of bootstrap dependencies to remove windows-target

Follow up to https://github.com/rust-lang/rust/pull/155444
2026-05-10 03:16:59 +02:00
Matthias Krüger 9165dbf12f Rollup merge of #155970 - tomilepp:issue-155968-fix, r=joshtriplett
Add mention of sendfile(2) and splice(2) to fs::copy() documentation.

Fixes rust-lang/rust#155968 by adding mention of sendfile(2) and splice(2) from io::copy()
2026-05-10 03:16:58 +02:00
Matthias Krüger 27282040f7 Rollup merge of #155705 - Jules-Bertholet:word-to-titlecase, r=Mark-Simulacrum
Add `str::word_to_titlecase()` to `alloc`

A small addition to https://github.com/rust-lang/rust/issues/153892.

Hasn't gone through ACP, so needs libs-API signoff.

@rustbot label A-Unicode T-libs-api
2026-05-10 03:16:58 +02:00
Matthias Krüger 17977f330e Rollup merge of #149362 - schneems:schneems/get_resolved_envs, r=Mark-Simulacrum
Add Command::get_resolved_envs

This addition allows an end-user to inspect the environment variables that are visible to the process when it boots.

Discussed in:

- Tracking issue: https://github.com/rust-lang/rust/issues/149070 (partially closes)
- ACP: https://github.com/rust-lang/libs-team/issues/194
2026-05-10 03:16:57 +02:00
León Orell Valerian Liehr ef282ff86b rustdoc: Reify emission types 2026-05-10 00:54:45 +02:00
bors ce89c89857 Auto merge of #148214 - WaffleLapkin:never-worn-never-type, r=fee1-dead
Consider `Result<T, Uninhabited>` and `ControlFlow<Uninhabited, T>` to be equivalent to `T` for must use lint





This is an extension to rust-lang/rust#147382.

With this PR `Result<T, Uninhabited>` and `ControlFlow<Uninhabited, T>` considered as must use iif `T` must be used.

For such cases the lint will mention that `T` is wrapped in a `Result`/`ControlFlow` with an uninhabited error/break.

The reasoning here is that `Result<T, Uninhabited>` is equivalent to `T` in which values can be represented and thus the must-used-ness should also be equivalent.

Fixes https://github.com/rust-lang/rust/issues/65861
2026-05-09 22:49:40 +00:00
Ralf Jung f48ca58010 Merge pull request #5016 from RalfJung/try_errnum_to_io_error
try_errnum_to_io_error: better support for unix targets on unix hosts
2026-05-09 21:04:40 +00:00
Ralf Jung c2bb45ecc2 Merge pull request #5014 from RalfJung/permissions
support chmod and fchmod on unix hosts
2026-05-09 20:42:55 +00:00
Ralf Jung e549493e0f try_errnum_to_io_error: better support for unix targets on unix hosts 2026-05-09 22:33:50 +02:00
Ralf Jung 9c42644217 support chmod and fchmod on unix hosts 2026-05-09 22:16:20 +02:00
bors 82bee96507 Auto merge of #155321 - briansmith:b/bufwriter-conservative, r=Mark-Simulacrum
`BufWriter`: Make the soundness of `BorrowedBuf` usage clearer.

The previous safety comment was outdated as it was written before `BorrowedBuf::set_init` was changed to be a boolean. It also failed to address the possibility that `flush_buf` invalidated the assumption.
2026-05-09 18:40:20 +00:00
Tomi Leppikangas f4adc40bbe Add mention of sendfile(2) and splice(2) to fs::copy() documentation.
* Add mention of sendfile(2) and splice(2) to fs::copy() documentation.
* Oxford comma fix
2026-05-09 17:43:33 +00:00
Jules Bertholet 40da877450 Add str::word_to_titlecase() to alloc
* Add `str::word_to_titlecase()` to `alloc`
* Address review comment
2026-05-09 17:42:42 +00:00
Ralf Jung 773af23505 stream_send_recv_stress tests: wait for threads to finish 2026-05-09 17:37:09 +02:00
Ralf Jung ea6eaab341 fstat: expose permissions in 'mode' field 2026-05-09 16:42:37 +02:00
Sasha Pourcelot dcdba78e7e rustc_attr_parsing: add AcceptContext::expect_string_literal 2026-05-09 14:21:05 +00:00
Sasha Pourcelot 9097f5b67a rustc_attr_parsing: improve error message for codegen attributes 2026-05-09 14:10:52 +00:00
bors 29155a4cd6 Auto merge of #156361 - jhpratt:rollup-G3Jg88X, r=jhpratt
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#156354 (Update example code of `std::array::from_fn`)
 - rust-lang/rust#156359 (use `cfg_select!` in integer `{to, from}_{le, be}`)
 - rust-lang/rust#156124 (Make stable hashing names consistent (part 2))
 - rust-lang/rust#156235 (fix: Guard SizeSkeleton::compute against stack overflow)
 - rust-lang/rust#156353 (resolve: Set correct parent and expansion for `self` declarations)
2026-05-09 13:52:56 +00:00
Jacob Pratt c32a2cd0a2 Rollup merge of #156353 - petrochenkov:selfdecl, r=mu001999
resolve: Set correct parent and expansion for `self` declarations

Follow up to https://github.com/rust-lang/rust/pull/146972 and https://github.com/rust-lang/rust/pull/154313.

The `parent` seems to not be used yet, it will ICE if used (https://github.com/rust-lang/rust/pull/156185 uses it).
The `expn_id` is only relevant to macros 2.0, I won't bother coming up with a test.
2026-05-09 09:27:59 -04:00
Jacob Pratt 80263e17a3 Rollup merge of #156235 - rajgandhi1:compiler_stack_overflow_fix, r=adwinwhite
fix: Guard SizeSkeleton::compute against stack overflow

Fixes rust-lang/rust#156137

Fix: extract the recursion into a private `compute_inner` that carries a depth counter. When depth exceeds the crate's recursion limit, return `LayoutError::Unknown` and let the existing transmute size-check produce a normal error instead of crashing.

A regression test is included in `tests/ui/transmute/`.
2026-05-09 09:27:58 -04:00
Jacob Pratt 71e64b9d25 Rollup merge of #156124 - nnethercote:StableHash-renamings-2, r=jieyouxu
Make stable hashing names consistent (part 2)

This PR finishes the implementation of MCP 893.

r? @jieyouxu
2026-05-09 09:27:58 -04:00
Jacob Pratt 2976a2ceab Rollup merge of #156359 - folkertdev:to-from-be-le-cfg-select, r=chenyukang
use `cfg_select!` in integer `{to, from}_{le, be}`

A simple bit of cleanup.
2026-05-09 09:27:57 -04:00
Jacob Pratt 3e95ad5c56 Rollup merge of #156354 - lms0806:issue_156102, r=chenyukang
Update example code of `std::array::from_fn`

Since the std::array::from_fn feature has been stabilized since version 1.91.1, the comment stating that it is not stable has been removed.

Additionally, the related example code has been modified into a simple example that is easy to understand.

Close rust-lang/rust#156102
2026-05-09 09:27:56 -04:00