Commit Graph

173274 Commits

Author SHA1 Message Date
bors 045b17737d Auto merge of #156118 - RalfJung:miri, r=RalfJung
miri subtree update

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

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

r? @ghost
2026-05-03 22:28:16 +00:00
bors ad3a598ca4 Auto merge of #156113 - JonathanBrouwer:rollup-yXpNY1L, r=JonathanBrouwer
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#153536 (Add `const_param_ty_unchecked` gate)
 - rust-lang/rust#155528 (const-stabilize `char::is_control()`)
 - rust-lang/rust#156086 (VaList::next_arg: track_caller for better Miri errors)
2026-05-03 17:54:12 +00:00
Ralf Jung 64ab20128c tid handling: cleanup and unification 2026-05-03 19:37:55 +02:00
Jonathan Brouwer 06354f4e17 Rollup merge of #156086 - RalfJung:next-arg-miri-errs, r=folkertdev
VaList::next_arg: track_caller for better Miri errors

The test diff should explain why this is better. :)

r? @folkertdev
2026-05-03 19:23:53 +02:00
Jonathan Brouwer 081e7c4481 Rollup merge of #155433 - oli-obk:bye-bye-long-attribute, r=RalfJung,ShoyuVanilla
Rip out rustc_layout_scalar_valid_range_* attribute support

And either removes tests for it or replaces the uses with pattern types.

primarily fixes rust-lang/rust#135996

fixes rust-lang/rust#147761
fixes rust-lang/rust#133652
2026-05-03 16:33:22 +02:00
Jonathan Brouwer bc6d9b1aa3 Rollup merge of #156073 - GuillaumeGomez:doc-cfg-reexports, r=Urgau
[rustdoc] Fix `doc_cfg` feature on reexports

Part of rust-lang/rust#150268.

I don't mark the issue as fixed as I need to check the third case described in the issue. First commit comes from https://github.com/rust-lang/rust/pull/156020, will need to rebase this PR once the original is merged.

r? @Urgau
2026-05-03 16:33:20 +02:00
bors 54f67d248b Auto merge of #155996 - flip1995:clippy-subtree-update, r=Manishearth
Clippy subtree update

r? Manishearth
2026-05-03 09:53:02 +00:00
Oli Scherer 11d88ee42b Rip out rustc_layout_scalar_valid_range_* attribute support 2026-05-03 10:59:52 +02:00
Ralf Jung f11819ce16 fmt and clippy 2026-05-03 10:08:22 +02:00
Ralf Jung 1cbe0d108f Merge ref '44860d3e9ef7' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@44860d3e9e
Filtered ref: rust-lang/miri@e4425fbb4f
Upstream diff: https://github.com/rust-lang/rust/compare/a021a7796f66600f46013d6c8d1dfc9e8d7f4a92...44860d3e9ef700cac0b4a61d924f41f46bf1b447

This merge was created using https://github.com/rust-lang/josh-sync.
2026-05-03 10:08:01 +02:00
Ralf Jung b0ca445c76 Prepare for merging from rust-lang/rust
This updates the rust-version file to 44860d3e9e.
2026-05-03 10:03:51 +02:00
Jacob Pratt c3afa21a40 Rollup merge of #156065 - mejrs:spanculler, r=JonathanBrouwer
Remove unused spans from AttributeKind

Recently I noticed some spans in diagnostic attributes were never used. I went through and checked the other variants too.
2026-05-03 00:25:33 -04:00
Guillaume Gomez ba27564259 Keep the original import DefId when inlining items through multiple reexports 2026-05-03 03:27:09 +02:00
Guillaume Gomez 6f644d8a77 Better use of conditions in propagate_doc_cfg 2026-05-03 03:26:34 +02:00
bors 20de910db4 Auto merge of #154341 - RalfJung:retag-on-typed-copy, r=oli-obk
Make retags an implicit part of typed copies



Ever since Stacked Borrows was first implemented in Miri, that was done with `Retag` statements: given a place (usually a local variable), those statements find all references stored inside the place and refresh their tags to ensure the aliasing requirements are upheld. However, this is a somewhat unsatisfying approach for multiple reasons:
- It leaves open the [question](https://github.com/rust-lang/unsafe-code-guidelines/issues/371) of where to even put `Retag` statements. Over time, the AddRetag pass settled on one possible answer to this, but it wasn't very canonical.
- For assignments of the form `*ptr = expr`, if the assignment involves copying a reference, we probably want to do a retag -- but if we do a `Retag(*ptr)` as the next instruction, it can be non-trivial to argue that this even retags the right value, so we refrained from doing retags in that case. This has [come up](https://github.com/llvm/llvm-project/pull/160913#issuecomment-3341908717) as a potential issue for Rust making better use of LLVM "captures" annotations. (That said, there might be [other ways](https://github.com/rust-lang/unsafe-code-guidelines/issues/593#issuecomment-4328112031) to obtain this desired optimization.)
- Normal compilation avoids generating retags, but we still generate LLVM IR with `noalias`. What does that even mean? How do MIR optimization passes interact with retags? These are questions we have to figure out to make better use of aliasing information, but currently we can't even really ask such questions.

I think we should resolve all that by making retags part of what happens during a typed copy (a concept and interpreter infrastructure that did not exist yet when retags were initially introduced). Under this proposal, when executing a MIR assignment statement, what conceptually happens is as follows:
- We evaluate the LHS to a place.
- We evaluate the RHS to a value. This does a typed load from memory if needed, raising UB if memory does not contain a valid representation of the assignment's type.
- We walk that value, identify all references inside of it, and retag them. If this happens as part of passing a function argument, this is a protecting retag.
- We store (a representation of) the value into the place.

However, this semantics doesn't fully work: there's a mandatory MIR pass that turns expressions like `&mut ***ptr` into intermediate deref's. Those must *not* do any retags. So far this happened because the AddRetag pass did not add retags for assignments to deref temporaries, but that information is not recorded in cross-crate MIR. Therefore I instead added a field to `Rvalue::Use` to indicate whether this value should be retagged or not. A non-retagging copy seems like a sufficiently canonical primitive that we should be able to express it. Dealing with the fallout from that is a large chunk of the overall diff. (I also considered adding this field to `StatementKind::Assign` instead, but decided against that as we only actually need it for `Rvalue::Use`. I am not sure if this was the right call...)

This neatly answers the question of when retags should occur, and handles cases like `*ptr = expr`. It avoids traversing values twice in Miri. It makes codegen's use of `noalias` sound wrt the actual MIR that it is working on. It also gives us a target semantics to evaluate MIR opts against. However, I did not carefully check all MIR opts -- in particular, GVN needs a thorough look under the new semantics; it currently can turn alias-correct code into alias-incorrect code. (But this PR doesn't make things any worse for normal compilation where the retag indicator is anyway ignored.)

Another side-effect of this PR is that `-Zmiri-disable-validation` now also disables alias checking. It'd be nicer to keep them orthogonal but I find this an acceptable price to pay.

- [rustc benchmark results](https://github.com/rust-lang/rust/pull/154341#issuecomment-4125313290)
- [miri benchmark results](https://github.com/rust-lang/rust/pull/154341#issuecomment-4129840926)
2026-05-02 17:42:41 +00:00
Ralf Jung 9311fc4f43 Merge pull request #4944 from hsqStephenZhang/feat/tid_cpu_affinity
feat: tid support to sched_getaffinity/sched_setaffinity
2026-05-02 17:23:49 +00:00
hsqStephenZhang 5eabccd4be feat: tid support to sched_getaffinity/sched_setaffinity 2026-05-02 18:55:04 +02:00
Guillaume Gomez d4997ca71d Fix doc_cfg feature on reexports 2026-05-02 18:08:26 +02:00
mejrs 4a13f36265 Remove more spans from AttributeKind 2026-05-02 17:41:30 +02:00
Ralf Jung e402c1edf0 miri: remove retag statements, make typed copies retag implicitly instead 2026-05-02 17:40:33 +02:00
bors 3d5dfdc29f Auto merge of #156088 - JonathanBrouwer:rollup-qdmx6JQ, r=JonathanBrouwer
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#156074 (Add extra symbol check for `.to_owned()`)
 - rust-lang/rust#156045 (Move tests associated consts)
 - rust-lang/rust#156064 (Do not depend on typeck to borrow-check inline consts.)
 - rust-lang/rust#156083 (Move tests attributes)
2026-05-02 14:30:57 +00:00
Jonathan Brouwer 6fa22653f9 Rollup merge of #156074 - EvoPot:cow-diag-item, r=chenyukang
Add extra symbol check for `.to_owned()`

Follow up of rust-lang/rust#154646

Previously when adding a suggestion for using `Cow::into_owned()` instead of `ToOwned::to_owned()`, the compiler would just convert the methods `Span` into a `String` and do checks on that `String`. This PR adds an extra guard to that suggestion by checking if the method is `sym::to_owned_method`.

r? @davidtwco since you added the review to the previous PR
2026-05-02 16:19:19 +02:00
Ralf Jung 9cdf5dc515 VaList::next_arg: track_caller for better Miri errors 2026-05-02 14:33:04 +02:00
EvoPot 8a77369ca4 Add extra symbol check for .to_owned()
Previously when adding a suggestion for using `Cow::into_owned()`
instead of `ToOwned::to_owned()`, the compiler would just convert the
methods `Span` into a `String` and do checks on that `String`. This PR
adds an extra guard to that suggestion by checking if the method is
`sym::to_owned_method`.
2026-05-02 14:47:29 +03:00
Ralf Jung 60c87897ab ensure we also test libc affinity functions on BSD 2026-05-02 13:34:36 +02:00
bors 696d5929af Auto merge of #156078 - JonathanBrouwer:rollup-WF8BsN3, r=JonathanBrouwer
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#156030 (Make stable hashing names consistent (part 1))
 - rust-lang/rust#156020 (Improve source code for `librustdoc/visit_ast.rs`)
 - rust-lang/rust#156021 (Clean up some traits)
 - rust-lang/rust#156028 (Add a `Local::arg(i)` helper constructor)
 - rust-lang/rust#156037 (Add AcceptContext::expect_no_args)
 - rust-lang/rust#156040 (Add missing alias to mailmap)
 - rust-lang/rust#156048 (Make `diverging_type_vars` a vec of `TyVid`)
 - rust-lang/rust#156053 (Reuse CTFE MIR for constructors.)
 - rust-lang/rust#156059 (compiler: Print valid `-Zmir-enable-passes` names if invalid name is used)

Failed merges:

 - rust-lang/rust#155940 (refactor rustc_on_unimplemented's filtering)
 - rust-lang/rust#156065 (Remove unused spans from AttributeKind)
2026-05-02 11:16:52 +00:00
Jonathan Brouwer f6f03a1651 Rollup merge of #156020 - GuillaumeGomez:cleanup-code, r=urgau
Improve source code for `librustdoc/visit_ast.rs`

While working on this part of rustdoc, got annoyed at the tuples and decided to transform them into types. Code is now much easier to follow. :3

r? @Urgau
2026-05-02 10:18:27 +02:00
Nicholas Nethercote e7d28d3e9b Rename the HashStable* trait/derives as StableHash*.
Specifically:
- `HashStable` -> `StableHash` (trait)
- `HashStable` -> `StableHash` (derive)
- `HashStable_NoContext` -> `StableHash_NoContext` (derive)

Note: there are some names in `compiler/rustc_macros/src/hash_stable.rs`
that are still to be renamed, e.g. `HashStableMode`.

Part of MCP 983.
2026-05-02 10:16:40 +02:00
bors 8275de8cdd Auto merge of #156069 - weihanglo:update-cargo, r=weihanglo
Update cargo submodule

10 commits in eb9b60f1f6604b5e022c56be31692c215b8ba11d..4f9b52075316e9ced380c8fa492858048d5758b6
2026-04-24 20:52:07 +0000 to 2026-05-01 22:36:41 +0000
- chore(deps): update compatible (rust-lang/cargo#16952)
- feat(lints): Add deny-by-default text_direction_codepoint lints (rust-lang/cargo#16950)
- chore(deps): update embarkstudios/cargo-deny-action action to v2.0.17 (rust-lang/cargo#16953)
- docs(guide): Switch from third-party to first-party unused deps detection (rust-lang/cargo#16946)
- Remove curl dependency from crates-io crate (rust-lang/cargo#16936)
- chore(deps): update gix to 0.83 (rust-lang/cargo#16945)
- fix(compile): Where possible, hint about misplaced deps  (rust-lang/cargo#16940)
- Remove `windows-sys` from `home` (rust-lang/cargo#16918)
- docs(resolver): `--precise <yanked>` is on stable (rust-lang/cargo#16944)
- Update `gix` to 0.82 (with security fixes and hardened parsers) (rust-lang/cargo#16941)
2026-05-02 07:58:56 +00:00
Guillaume Gomez 201d567654 Rollup merge of #154571 - chenyukang:yukang-fix-alias-path, r=clubby789
Fix alias path for rustdoc

I ran this command:

```console
x build --stage 1  --skip rustdoc
Building bootstrap
   Compiling bootstrap v0.0.0 (/Users/yukang/rust/src/bootstrap)
    Finished `dev` profile [unoptimized] target(s) in 1.08s
/Users/yukang/rust/build/aarch64-apple-darwin/ci-llvm/bin/llvm-strip does not exist; skipping copy
Building stage1 compiler artifacts (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized + debuginfo] target(s) in 0.45s
Creating a sysroot for stage1 compiler (use `rustup toolchain link 'name' build/host/stage1`)
Building stage1 library artifacts{alloc, compiler_builtins, core, panic_abort, panic_unwind, proc_macro, rustc-std-workspace-core, std, std_detect, sysroot, test, unwind} (stage1 -> stage1, aarch64-apple-darwin)
    Finished `dist` profile [optimized + debuginfo] target(s) in 0.10s
Skipping Set({build::src/tools/rustdoc}) because it is excluded
Building stage1 rustdoc_tool_binary (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized + debuginfo] target(s) in 0.19s
```

expect all `rustdoc` related compiling phase will be exlcuded, but from the log we can see `rustdoc_tool_binary` is still compiled.

`src/tools/rustdoc` and `src/librustdoc` are documented as aliases in path set here:
https://github.com/rust-lang/rust/blob/a25435bcf7cfc9b953d356eda3a51db8da9e3386/src/bootstrap/src/core/builder/mod.rs#L355-L360

we can also see here two paths are treated as alias:
https://github.com/rust-lang/rust/blob/a25435bcf7cfc9b953d356eda3a51db8da9e3386/src/bootstrap/src/core/build_steps/check.rs#L818-L822

but bootstrap registered them as two different sets with `.path(..).path(...)`:
https://github.com/rust-lang/rust/blob/a25435bcf7cfc9b953d356eda3a51db8da9e3386/src/bootstrap/src/core/build_steps/tool.rs#L691-L693

That meant commands like `x build --skip rustdoc`, `--skip src/tools/rustdoc`, or `--skip src/librustdoc` only excluded one side.
2026-05-02 04:12:05 +02:00
Weihang Lo acf0736c63 Update cargo submodule 2026-05-01 20:57:09 -04:00
Ralf Jung fb4bf6e698 Merge pull request #4981 from gruenich/feature/update-github-actions
[ci] Update GitHub Actions to last major release
2026-05-01 20:38:12 +00:00
Ralf Jung 5b14c92547 Merge pull request #4987 from WhySoBad/network-socket-shutdown
Add network socket `shutdown` shim
2026-05-01 17:31:28 +00:00
bors 67bcaa9c4b Auto merge of #153968 - jyn514:jyn/linker-warn-by-default, r=mati865
linker-messages is warn-by-default again

cc rust-lang/rust#136096 

I ended up keeping it a lint and adding an option for lints to ignore `-Dwarnings` (there was already a lint that did that actually, it was just hard-coded in rustc_middle instead of in rustc_lint_defs like I'd expect). This allows people to actually see the warnings without them failing the build in CI.
2026-05-01 17:15:17 +00:00
Guillaume Gomez f19e850f59 Improve source code for librustdoc/visit_ast.rs 2026-05-01 16:20:39 +02:00
WhySoBad 563f4af7ab Add shutdown shim for network sockets 2026-05-01 13:29:37 +02:00
Jonathan Brouwer 0606270cda Rollup merge of #149637 - Flakebi:fix-convergent-mir-opts, r=nnethercote
Do not run jump-threading for GPUs

GPU targets have convergent operations that must not be duplicated or
moved in or out of control-flow.
An example convergent operation is a barrier/syncthreads.

The only MIR pass affected by this is jump-threading, it can duplicate
calls. Disable jump-hreading for GPU targets to prevent generating
incorrect code.

This affects the amdgpu and nvptx targets.

Fixes rust-lang/rust#137086, see this issue for details.
Tracking issue: rust-lang/rust#135024

cc @RDambrosio016 @kjetilkjeka for nvptx
cc @ZuseZ4
2026-05-01 13:10:32 +02:00
Jacob Pratt fbde425c84 Rollup merge of #156015 - tshepang:rdg-sync, r=tshepang
rustc-dev-guide subtree update

Subtree update of `rustc-dev-guide` to https://github.com/rust-lang/rustc-dev-guide/commit/cdd2373cb446ad722b160c5d599910452b3997ee.

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

r? @ghost
2026-04-30 22:28:36 -04:00
Jacob Pratt 894bdf298e Rollup merge of #155980 - nnethercote:mv-feature-methods, r=TaKO8Ki
Move `feature*` methods from `parse` mod to `errors` mod.

As the FIXME comment says, these no longer use `ParseSess` and so the `parse` mod is not a good place for them. The `errors` mod is a better home.

r? @TaKO8Ki
2026-04-30 22:28:33 -04:00
Jacob Pratt 0a05ddf92b Rollup merge of #155954 - cijiugechu:doc_cfg-decl-macro, r=notriddle
rustdoc: preserve parent doc cfg for `macro_export` macros

The detached-item context is discovered before `propagate_doc_cfg`, it is carried on the clean item and consumed by the pass.

Closes rust-lang/rust#100916
2026-04-30 22:28:27 -04:00
Nicholas Nethercote 339797e8b6 Eliminate rustc_lint_defs' dependency on rustc_ast.
It currently only depends on two things:
- `rustc_ast::AttrId`: this is just a re-export of `rustc_span::AttrId`,
  so we can import the original instead.
- `rustc_ast::AttributeExt`: needed only for the `name` and `id`
  methods. We can instead pass in the `name` and `id` directly.
2026-05-01 10:58:42 +10:00
Tshepang Mbambo c0e3f05f46 reflow 2026-04-30 20:37:36 +02:00
Tshepang Mbambo cd47965c28 sembr src/panic-implementation.md 2026-04-30 20:35:27 +02:00
Tshepang Mbambo c4ad3037e6 sembr src/tests/directives.md 2026-04-30 20:34:39 +02:00
Tshepang Mbambo 373f5d3987 sembr src/tests/compiletest.md 2026-04-30 20:33:33 +02:00
Tshepang Mbambo 958600a559 sembr src/backend/backend-agnostic.md
It has required much reflowing
(and sembr tool is not fancy enough yet)
2026-04-30 20:31:25 +02:00
Tshepang Mbambo d12e52d852 reflow 2026-04-30 20:28:39 +02:00
Tshepang Mbambo 44034eca66 inclusive wording 2026-04-30 20:07:22 +02:00
Tshepang Mbambo d6af96f447 reflow 2026-04-30 20:02:35 +02:00
Tshepang Mbambo 80f3a50056 sembr src/asm.md 2026-04-30 19:01:35 +02:00