Commit Graph

324669 Commits

Author SHA1 Message Date
Oli Scherer bfb085da9f All generated associated types for opaque types in traits/impls have the same parent 2026-04-24 12:55:11 +02:00
Oli Scherer e90878b9f2 All nested statics in a single interning run have the same parent
So we do not need to disambiguate considering parents
2026-04-24 12:45:55 +02:00
bors 92c7010294 Auto merge of #155609 - cuviper:thread_pool-seq-cst, r=jieyouxu
rustc_thread_pool: Make `CoreLatch::set` use `SeqCst` instead of `AcqRel`

Every other modification of this variable uses `SeqCst`, which is justified in the sleep README. This particular choice of `AcqRel` was not discussed during its addition in rayon-rs/rayon#746, nor rayon-rs/rfcs#5, so I suspect was simply an oversight from earlier development. We probably do want this to participate in the same sequential consistency.

The only other ordering difference is `CoreLatch::probe`'s load with `Acquire`, which should be fine because this doesn't need consistency with the sleep counters.

See also rayon-rs/rayon#1297. As I commented there, I think in practice this would be quite rare to cause any problems, but it *could* be a source of non-deterministic bugs on targets with weak memory ordering.
2026-04-23 05:30:11 +00:00
bors 5095b44caf Auto merge of #154596 - alexcrichton:update-wasi-sdk, r=jieyouxu
Update to wasi-sdk-32 in CI/releases

Similar to prior updates such as rust-lang/rust#149037. This notably pulls in some bug fixes for wasi-libc around nonblocking I/O and networking.
2026-04-23 01:39:51 +00:00
bors 30837cb66d Auto merge of #155550 - zetanumbers:cache_insert_unique, r=oli-obk
Replace `ShardedHashMap` method `insert` with debug-checked `insert_unique`

Currently every use of `ShardedHashMap::insert` checks that it won't evict an old value due to unique key. I haven't found any issue related to that faulty condition, so I thought of replacing it with `ShardedHashMap::insert_unique` which doesn't check for this condition unless `debug_assertions` are enabled. This might improve the performance.

r? @petrochenkov
2026-04-22 22:28:22 +00:00
bors 913e4bea83 Auto merge of #155655 - JonathanBrouwer:rollup-KFUw3UR, r=JonathanBrouwer
Rollup of 10 pull requests

Successful merges:

 - rust-lang/rust#154794 (Add on_unmatch_args)
 - rust-lang/rust#155133 (Document precision considerations of `Duration`-float methods)
 - rust-lang/rust#154283 (Remove `nodes_in_current_session` field and related assertions)
 - rust-lang/rust#155374 (rustdoc: fix a few spots where emit isn't respected)
 - rust-lang/rust#155587 (Immediately feed visibility on DefId creation)
 - rust-lang/rust#155622 (c-variadic: `va_arg` fixes )
 - rust-lang/rust#155629 (rustc_public: Add `constness` & `asyncness` in `FnDef`)
 - rust-lang/rust#155632 (Some metadata cleanups)
 - rust-lang/rust#155639 (BinOpAssign always returns unit)
 - rust-lang/rust#155647 (rustc-dev-guide subtree update)
2026-04-22 19:16:27 +00:00
Jonathan Brouwer e94e3ccca8 Rollup merge of #155647 - 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/bed088a2db71e117f2021214b558341c58b23d72.

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

r? @ghost
2026-04-22 19:18:33 +02:00
Jonathan Brouwer c4b5ea9625 Rollup merge of #155639 - oli-obk:builtin-binop-const, r=nnethercote
BinOpAssign always returns unit

I don't know why we treated assign ops as returning their binop type sometimes, but it's usually ignored later anyway and mostly affects infer vars.

Also updated a comment from 11 years ago when SIMD types apparently had builtin `==` logic.
2026-04-22 19:18:32 +02:00
Jonathan Brouwer 6f6e6bb485 Rollup merge of #155632 - nnethercote:split-Metadata, r=mejrs
Some metadata cleanups

Details in individual commits.

r? @mejrs
2026-04-22 19:18:32 +02:00
Jonathan Brouwer b0d794f425 Rollup merge of #155629 - cijiugechu:fn_constness, r=makai410
rustc_public: Add `constness` & `asyncness` in `FnDef`

Resolves [https://github.com/rust-lang/project-stable-mir/issues/111](https://github.com/rust-lang/project-stable-mir/issues/111).
2026-04-22 19:18:31 +02:00
Jonathan Brouwer e9972d9dec Rollup merge of #155622 - folkertdev:va-arg-llvm-fixes, r=tgross35
c-variadic: `va_arg` fixes

tracking issue: https://github.com/rust-lang/rust/issues/44930

extracts some generic LLVM `va_arg` fixes from https://github.com/rust-lang/rust/pull/152576 and https://github.com/rust-lang/rust/pull/155429.

r? tgross35
2026-04-22 19:18:30 +02:00
Jonathan Brouwer 5e48418496 Rollup merge of #155587 - oli-obk:feed-visibility-no-hash, r=petrochenkov
Immediately feed visibility on DefId creation

This system was originally introduced in rust-lang/rust#121089

This PR was enabled by refactorings in rust-lang/rust#154945, because after that, the visibility feeding happens directly after the `DefId` creation, so we don't need to go through the intermediate hash table anymore

Should unblock rust-lang/rust#138995
2026-04-22 19:18:29 +02:00
Jonathan Brouwer dcde112616 Rollup merge of #155374 - notriddle:non-static-dep-info, r=fmease
rustdoc: fix a few spots where emit isn't respected

Addresses the third list item of rust-lang/rust#155298
2026-04-22 19:18:29 +02:00
Jonathan Brouwer 8bade0362d Rollup merge of #154283 - Zoxc:rem-nodes_in_current_session, r=nnethercote
Remove `nodes_in_current_session` field and related assertions

This removes the `nodes_in_current_session` field and related assertions. These are enabled if `-Z incremental-verify-ich` is passed or `debug_assertions` is on. Historically these have been useful to catch query keys with improper `HashStable` impls which lead to collisions.

We currently also check for duplicate nodes when loading the dep graph. This check is more complete as it covers the entire dep graph and is enabled by default. It doesn't provide a query key for a collision however. This check is also delayed to the next incremental session.

We also have the `verify_query_key_hashes` which is also enabled if `-Z incremental-verify-ich` is passed or `debug_assertions` is on. This checks for dep node conflicts in each query cache and provides 2 conflicting keys if present.

I think these remaining checks are sufficient and so we can remove `nodes_in_current_session`.
2026-04-22 19:18:28 +02:00
Jonathan Brouwer d7bb378724 Rollup merge of #155133 - cuviper:duration_fp_docs, r=the8472
Document precision considerations of `Duration`-float methods

A `Duration` is essentially a 94-bit value (64-bit sec and ~30-bit ns),
so there's some inherent loss when converting to floating-point for
`mul_f64` and `div_f64`. We could go to greater lengths to compute these
with more accuracy, like rust-lang/rust#150933 or rust-lang/rust#154107,
but it's not clear that it's worth the effort. The least we can do is
document that some rounding is to be expected, which this commit does
with simple examples that only multiply or divide by `1.0`.

This also changes the `f32` methods to just forward to `f64`, so we keep
more of that duration precision, as the range is otherwise much more
limited there.
2026-04-22 19:18:27 +02:00
Jonathan Brouwer 5ad7363c39 Rollup merge of #154794 - chenyukang:yukang-fix-152494-incomplete-macro-args, r=mejrs
Add on_unmatch_args

Fixes rust-lang/rust#152494
r? @estebank
2026-04-22 19:18:26 +02:00
bors f676c20edd Auto merge of #155343 - dianqk:indirect-by-ref, r=nikic
codegen: Copy to an alloca when the argument is neither by-val nor by-move for indirect pointer.



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

When a value is passed via an indirect pointer, the value needs to be copied to a new alloca. For x86_64-unknown-linux-gnu, `Thing` is the case:

```rust
#[derive(Clone, Copy)]
struct Thing(usize, usize, usize);

pub fn foo() {
    let thing = Thing(0, 0, 0);
    bar(thing);
    assert_eq!(thing.0, 0);
}

#[inline(never)]
#[unsafe(no_mangle)]
pub fn bar(mut thing: Thing) {
    thing.0 = 1;
}
```

Before passing the thing to the bar function, the thing needs to be copied to an alloca that is passed to bar.

```llvm
%0 = alloca [24 x i8], align 8
call void @llvm.memcpy.p0.p0.i64(ptr align 8 %0, ptr align 8 %thing, i64 24, i1 false)
call void @bar(ptr %0)
```

This patch applies the rule to the untupled arguments as well.

```rust
#![feature(fn_traits)]

#[derive(Clone, Copy)]
struct Thing(usize, usize, usize);

#[inline(never)]
#[unsafe(no_mangle)]
pub fn foo() {
    let thing = (Thing(0, 0, 0),);
    (|mut thing: Thing| {
        thing.0 = 1;
    }).call(thing);
    assert_eq!(thing.0.0, 0);
}
```

For this case, this patch changes from

```llvm
; call example::foo::{closure#0}
call void @_RNCNvCs15qdZVLwHPA_7example3foo0B3_(ptr ..., ptr %thing)
```

to

```llvm
%0 = alloca [24 x i8], align 8
call void @llvm.memcpy.p0.p0.i64(ptr align 8 %0, ptr align 8 %thing, i64 24, i1 false)
; call example::foo::{closure#0}
call void @_RNCNvCs15qdZVLwHPA_7example3foo0B3_(ptr ..., ptr %0)
```

However, the same rule cannot be applied to tail calls that would be unsound, because the caller's stack frame is overwritten by the callee's stack frame. Fortunately, https://github.com/rust-lang/rust/pull/151143 has already handled the special case. We must not copy again.

No copy is needed for by-move arguments, because the argument is passed to the called "in-place".

No copy is also needed for by-val arguments, because the attribute implies that a hidden copy of the pointee is made between the caller and the callee.


NOTE: The patch has a trick for tail calls that we pass by-move. We can choose to copy an alloca even for by-move arguments, but tail calls require MUST-by-move.
2026-04-22 15:47:21 +00:00
Tshepang Mbambo 85ffe928d8 Merge pull request #2846 from rust-lang/tshepang/sembr
sembr some files
2026-04-22 15:14:09 +02:00
Tshepang Mbambo a39bff7112 reflow 2026-04-22 15:07:45 +02:00
Tshepang Mbambo f7f7989c06 sembr src/name-resolution.md 2026-04-22 14:50:02 +02:00
Tshepang Mbambo ca75ba2345 improve coherence.md 2026-04-22 14:49:12 +02:00
Tshepang Mbambo 78b3073a74 sembr src/coherence.md 2026-04-22 14:47:52 +02:00
Tshepang Mbambo dc675c72d3 improve hir/lowering.md 2026-04-22 14:23:38 +02:00
Tshepang Mbambo 14dd4b2086 sembr src/hir/lowering.md 2026-04-22 14:18:09 +02:00
Tshepang Mbambo e704d0f624 improve stability.md 2026-04-22 14:08:22 +02:00
yukang 8d75f0cbfc add on_unmatch_args 2026-04-22 19:28:44 +08:00
Tshepang Mbambo c392defd21 sembr src/stability.md 2026-04-22 12:48:54 +02:00
Oli Scherer 3be0e76c36 Update a very outdated comment 2026-04-22 12:37:08 +02:00
Tshepang Mbambo a3a299256a sembr src/tests/compiletest.md 2026-04-22 12:36:35 +02:00
Tshepang Mbambo 6ff11cfdde make sentence feel more complete 2026-04-22 12:35:20 +02:00
Tshepang Mbambo 0be2aa6e27 sembr src/tests/ci.md 2026-04-22 12:33:55 +02:00
Tshepang Mbambo 4d31601bef title case 2026-04-22 12:31:32 +02:00
Tshepang Mbambo 5f0877e21b whitespace 2026-04-22 12:28:46 +02:00
Tshepang Mbambo 248cfe7312 sembr src/rustc-driver/external-rustc-drivers.md 2026-04-22 12:27:16 +02:00
Oli Scherer 24b1634898 BinOpAssign always returns unit 2026-04-22 12:27:03 +02:00
Tshepang Mbambo abb0d9a3f1 Merge pull request #2845 from rust-lang/rustc-pull
Rustc pull update
2026-04-22 12:11:27 +02:00
The rustc-josh-sync Cronjob Bot 95f4108b3a Merge ref 'cf1817bc6ecd' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@cf1817bc6e
Filtered ref: rust-lang/rustc-dev-guide@df639463eb
Upstream diff: https://github.com/rust-lang/rust/compare/84c11900724736a2b9afac4822031d78a9ed8e86...cf1817bc6ecd2d14ca492247c804bad31948dd56

This merge was created using https://github.com/rust-lang/josh-sync.
2026-04-22 10:00:56 +00:00
The rustc-josh-sync Cronjob Bot 3bb7d7d8a4 Prepare for merging from rust-lang/rust
This updates the rust-version file to cf1817bc6e.
2026-04-22 10:00:53 +00:00
Daria Sukhonina fa4d2ad671 Clarify behavior of ShardedHashMap::insert_unique 2026-04-22 12:39:19 +03:00
dianqk 10d8329061 codegen: Copy to an alloca when the argument is neither by-val nor by-move for indirect pointer. 2026-04-22 17:37:17 +08:00
dianqk e67e7162f7 Add miscompiled test cases 2026-04-22 17:36:33 +08:00
Folkert de Vries 5149a31515 change llvm.ptrmask argument to isize
we were saying that the type is i32, but would often provide an i64.
That never failed so far, but starts failing (like, crashing LLVM) when
working with 128-bit values that are 16-byte aligned. So, we may as well
use the more robust approach now.
2026-04-22 10:32:27 +02:00
Tshepang Mbambo f9566d6b10 Merge pull request #2844 from rust-lang/aj/rustc-internals-docs-clarity
Mentions rustc-docs for rustc_private
2026-04-22 09:50:10 +02:00
bors cf1817bc6e Auto merge of #155634 - jhpratt:rollup-lo99oO5, r=jhpratt
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#155589 (Forbid `check-pass`/`build-pass`/`run-pass` directives in incremental tests)
 - rust-lang/rust#155610 (Add missing `dyn` keyword to `trait_alias` page of the Unstable Book)
 - rust-lang/rust#155615 (test cleanups for `ui/derives` and `ui/deriving`)
 - rust-lang/rust#154874 (Fix ICE for inherited const conditions on const closures)
 - rust-lang/rust#155605 (std: Update support for `wasm32-wasip3`)
 - rust-lang/rust#155613 (c-variadic: tweak `std` docs)
 - rust-lang/rust#155619 (Remove a bunch of unnecessary explicit lifetimes from the ast validator)
2026-04-22 06:20:12 +00:00
Jacob Pratt 6fa2b1d01a Rollup merge of #155619 - oli-obk:ast-validation-lifetimes, r=dingxiangfei2009
Remove a bunch of unnecessary explicit lifetimes from the ast validator

Noticed while fiddling with error reporting. None of the lifetimes were ever used for anything
2026-04-22 01:53:43 -04:00
Jacob Pratt 48f36eda77 Rollup merge of #155613 - folkertdev:c-variadic-doc-tweaks, r=tgross35
c-variadic: tweak `std` docs

tracking issue: https://github.com/rust-lang/rust/issues/44930

In preparation of a rename of `arg` to `next_arg`

cc @workingjubilee
r? tgross35
2026-04-22 01:53:42 -04:00
Jacob Pratt 6c0cbcf038 Rollup merge of #155605 - alexcrichton:wasip3, r=jhpratt
std: Update support for `wasm32-wasip3`

This commit performs some minor update within the standard library for the `wasm32-wasip3` target. This target is a tier 3 target currently due to the WASIp3 specification not being officially released. This commit adds a dependency from the standard library on the `wasip3` crate in the same manner as the `wasip1` and `wasip2` crates that it already depends on. The use-sites, for randomness and environment variables, are then updated to handle the wasip2/wasip3 multiplexing.
2026-04-22 01:53:42 -04:00
Jacob Pratt b622dd00fb Rollup merge of #154874 - cijiugechu:fix-const-closure-inherited-conditions, r=oli-obk
Fix ICE for inherited const conditions on const closures

Synchronize `evaluate_host_effect_for_fn_goal` with the behavior of `extract_fn_def_from_const_callable` in new solver.

Closes rust-lang/rust#153861 .
2026-04-22 01:53:41 -04:00
Jacob Pratt ca4aaafbf2 Rollup merge of #155615 - cyrgani:clean-deriving, r=Kivooeo
test cleanups for `ui/derives` and `ui/deriving`

The eventual goal is for `ui/deriving` to be merged into `ui/derives` entirely. This PR focuses on the `issue-*.rs` tests in `deriving` and a few other no-longer-useful tests.
r? @Kivooeo
2026-04-22 01:53:40 -04:00
Jacob Pratt 0ab2cdf261 Rollup merge of #155610 - Omnikar:trait-alias-docs-fix, r=mejrs
Add missing `dyn` keyword to `trait_alias` page of the Unstable Book

There seemed to be a small typo in the Rust Unstable Book page for the `trait_alias` feature, where a variable is declared as `&Bar` for a trait `Bar`, rather than `&dyn Bar`.
2026-04-22 01:53:39 -04:00