Commit Graph

326258 Commits

Author SHA1 Message Date
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
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
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 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
Folkert de Vries 6c799065a4 use cfg_select! in {to, from}_{le, be} 2026-05-09 14:37:33 +02:00
Ralf Jung be7decec48 Merge pull request #5012 from RalfJung/libc-helpers
rename and adjust some libc test utils for better consistency with std
2026-05-09 12:32:32 +00:00
Ralf Jung b2afb173d6 rename and adjust some libc utils for better consistency with std 2026-05-09 14:07:48 +02:00
rajgandhi1 7a900df1b9 Guard SizeSkeleton::compute against stack overflow 2026-05-09 16:02:15 +05:30
lms0806 5d7f9b5755 chore : remove not stable explain and edit code explain 2026-05-09 17:51:24 +09:00
Vadim Petrochenkov 16729bcb2d resolve: Set correct parent and expansion for self declarations 2026-05-09 11:19:29 +03:00
Ralf Jung 556645f9c4 Merge pull request #5011 from xtqqczze/cargo-authors
cargo: Remove deprecated package authors field
2026-05-09 07:26:51 +00:00
bors 0490dd9385 Auto merge of #156351 - weihanglo:update-cargo, r=weihanglo
Update cargo submodule

13 commits in 4f9b52075316e9ced380c8fa492858048d5758b6..a343accce8526b128adc517d33348573d22920a3
2026-05-01 22:36:41 +0000 to 2026-05-08 22:41:35 +0000
- docs(guide): Fix a typo (rust-lang/cargo#16980)
- chore(deps): update msrv (3 versions) to v1.93 (rust-lang/cargo#16979)
- refactor(diag): Move lints to diagnostics (rust-lang/cargo#16978)
- refactor(lints): Pull out `unknown_lints` lint logic and `missing_lints_features` diagnostic logic (rust-lang/cargo#16976)
- refactor(lints): Move things out of `lints/mod.rs` (rust-lang/cargo#16975)
- test: cover search API redirects (rust-lang/cargo#16971)
- refactor(lints): Instrument lints for logging  (rust-lang/cargo#16972)
- docs: `.cargo-checksum.json` is not a security mechanism (rust-lang/cargo#16966)
- fix(vendor): add `$comment` to `.cargo-checksum.json` (rust-lang/cargo#16967)
- test: Fixed arg order in rustdoc json test (rust-lang/cargo#16968)
- fix(config): `[env]` relative paths definition  (rust-lang/cargo#16957)
- fix(config): normalize included config paths  (rust-lang/cargo#16964)
- Fix heading level of `build.warnings` documentation. (rust-lang/cargo#16961)

r? ghost
2026-05-09 05:35:45 +00:00
Weihang Lo 85b1075e17 Update cargo submodule 2026-05-08 23:53:25 -04:00
bors 4a997eeefb Auto merge of #156297 - ChayimFriedman2:lang-items-traits, r=mejrs
Implement some trait for next solver's lang item enums

rust-analyzer needs that.
2026-05-08 23:44:40 +00:00
Oli Scherer d3a8c2706a Merge pull request #5007 from RalfJung/backtrace-generics
try to remove generic normalization from backtraces
2026-05-08 21:08:29 +00:00