Skip to content

Rollup of 14 pull requests - #160310

Merged
rust-bors[bot] merged 34 commits into
rust-lang:mainfrom
jhpratt:rollup-0apoMmQ
Aug 1, 2026
Merged

Rollup of 14 pull requests#160310
rust-bors[bot] merged 34 commits into
rust-lang:mainfrom
jhpratt:rollup-0apoMmQ

Conversation

@jhpratt

@jhpratt jhpratt commented Aug 1, 2026

Copy link
Copy Markdown
Member

Successful merges:

r? @ghost

Create a similar rollup

icmccorm and others added 30 commits July 20, 2026 15:58
Constructing an Rc<[T]> or Arc<[T]> whose header + payload layout exceeds
isize::MAX unwrapped a LayoutError, panicking with the opaque "called
`Result::unwrap()` on an `Err` value: LayoutError". Match Vec and Box by
reporting "capacity overflow" instead, and add regression tests.
This FIXME was added in [1], at which point there were 8 arguments. Now
there are only 5, which is much more reasonable.

This commit was brought to you by https://oli-obk.github.io/fixmeh/.

[1]: rust-lang#78923
Forbid super/crate/self/Self to be used in register_tool.
Also, add test for raw identifier and unicode identifiers.
This adds back the previously existing duplicate tool error, but as a
suppressable lint.
This is already *supposed* to be impossible in layout, but this emphasizes that better.

Ironically I was inspired to do this as part of looking at making `Simd<T, 0>` *work*, but importantly if that's going to happen I think it should be `BackendRepr::Memory` like other ZSTs, *not* a `BackendRepr::ScalarVector` that would need to carry around a useless LLVM value in `OperandValue::Immediate` (where it's not even clear what the LLVM type of that value would be).
* docs: document the non_exhaustive attribute
* Add newline at end of attribute_docs.rs
* Update library/core/src/attribute_docs.rs

* Update library/core/src/attribute_docs.rs

Co-authored-by: Guillaume Gomez <contact@guillaume-gomez.fr>
Co-authored-by: Krisitan Erik Olsen <kristian.erik@outlook.com>
* fundamental only on first arg
* woo this made error messages nicer
* oh the test was misnamed lol
* special case only box
* rename tests

Co-authored-by: Nia Deckers <nia-e@haecceity.cc>
Instead of displaying all kind of tuples that implement a given trait, which
might flood the user, it displays a concise message only when all the involved
types are tuples.
…-5, r=saethlin

Emit retags in codegen to support BorrowSanitizer (part 5)

Tracking issue: rust-lang#154760
[Zulip Thread](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Staging.20for.20emitting.20retags.20in.20codegen/with/592364811)

This is one of several PRs that add experimental support for emitting retags as function calls in codegen.

This PR adds support for emitting global arrays that specify the ranges of interior mutable and pinned data. For example,
```rust
fn cell(x: &(i32, Cell<i32>)) { ... }
```
This program will have IR similar to the following:
```llvm
@anon.0 = unnamed_addr constant [16 x i8] c"\04...\04..."
define void @cell(ptr %0)  {
start:
  %x = call ptr @__rust_retag_reg(ptr %0, i64 8, i8 1, ptr @anon.0, ptr null)
  ...
}
```
The last four bytes at offset four are interior mutable.

Users can disable this behavior by passing `no-precise-im` or `no-precise-pin` as options to  `-Zcodegen-emit-retag`. In that case, the last two parameters to the retag intrinsic will always be null pointers.

BorrowSanitizer will be able to switch to using nightly once this is merged. Thank you @saethlin for reviewing these PRs!

Note: we still do not support retagging SIMD types, since cg-ssa does not support `insertelement`.

Related: rust-lang#158100

Cc: @RalfJung
r? @saethlin
…overflow, r=JohnTitor

Report "capacity overflow" for oversized Rc<[T]>/Arc<[T]>

Fixes rust-lang#136797.

Building an Rc<[T]>/Arc<[T]> whose header + payload layout exceeds
isize::MAX unwrapped a LayoutError and panicked with "called
Result::unwrap() on an Err value: LayoutError". Vec and Box report
"capacity overflow" here; this makes Rc/Arc do the same.

Used an inline panic!("capacity overflow") rather than raw_vec's
capacity_overflow(), since that helper is cfg'd out under
no_global_oom_handling while these two layout fns still compile there.
make atomic operations const

In a similar vein to rust-lang#159094, it makes sense to make these `const fn` so that code can be shared between compile-time and run-time even if the runtime version has to deal with concurrency.

This constifies the following:
```rust
// core::sync::atomic

impl AtomicBool {
    pub const fn get_mut(&mut self) -> &mut bool;
    pub const fn from_mut(v: &mut bool) -> &mut Self;
    pub const fn get_mut_slice(this: &mut [Self]) -> &mut [bool];
    pub const fn from_mut_slice(v: &mut [bool]) -> &mut [Self];
    pub const fn load(&self, order: Ordering) -> bool;
    pub const fn store(&self, val: bool, order: Ordering);
    pub const fn swap(&self, val: bool, order: Ordering) -> bool;
    pub const fn compare_and_swap(&self, current: bool, new: bool, order: Ordering) -> bool;
    pub const fn compare_exchange(
        &self,
        current: bool,
        new: bool,
        success: Ordering,
        failure: Ordering,
    ) -> Result<bool, bool>;
    pub const fn compare_exchange_weak(
        &self,
        current: bool,
        new: bool,
        success: Ordering,
        failure: Ordering,
    ) -> Result<bool, bool>;
    pub const fn fetch_and(&self, val: bool, order: Ordering) -> bool;
    pub const fn fetch_nand(&self, val: bool, order: Ordering) -> bool;
    pub const fn fetch_or(&self, val: bool, order: Ordering) -> bool;
    pub const fn fetch_xor(&self, val: bool, order: Ordering) -> bool;
    pub const fn fetch_not(&self, order: Ordering) -> bool;
}

impl AtomicPtr<T> {
    pub const fn get_mut(&mut self) -> &mut *mut T;
    pub const fn from_mut(v: &mut *mut T) -> &mut Self;
    pub const fn get_mut_slice(this: &mut [Self]) -> &mut [*mut T];
    pub const fn from_mut_slice(v: &mut [*mut T]) -> &mut [Self];
    pub const fn load(&self, order: Ordering) -> *mut T;
    pub const fn store(&self, ptr: *mut T, order: Ordering);
    pub const fn swap(&self, ptr: *mut T, order: Ordering) -> *mut T;
}

impl Atomic$Int {
    pub const fn get_mut(&mut self) -> &mut $int_type;
    pub const fn from_mut(v: &mut $int_type) -> &mut Self;
    pub const fn get_mut_slice(this: &mut [Self]) -> &mut [$int_type];
    pub const fn from_mut_slice(v: &mut [$int_type]) -> &mut [Self];
    pub const fn load(&self, order: Ordering) -> $int_type;
    pub const fn store(&self, val: $int_type, order: Ordering);
    pub const fn swap(&self, val: $int_type, order: Ordering) -> $int_type;
    pub const fn compare_and_swap(&self,
                                    current: $int_type,
                                    new: $int_type,
                                    order: Ordering) -> $int_type;
    pub const fn compare_exchange(&self,
                                    current: $int_type,
                                    new: $int_type,
                                    success: Ordering,
                                    failure: Ordering) -> Result<$int_type, $int_type>;
    pub const fn compare_exchange_weak(&self,
                                         current: $int_type,
                                         new: $int_type,
                                         success: Ordering,
                                         failure: Ordering) -> Result<$int_type, $int_type>;
    pub const fn fetch_add(&self, val: $int_type, order: Ordering) -> $int_type;
    pub const fn fetch_sub(&self, val: $int_type, order: Ordering) -> $int_type;
    pub const fn fetch_and(&self, val: $int_type, order: Ordering) -> $int_type;
    pub const fn fetch_nand(&self, val: $int_type, order: Ordering) -> $int_type;
    pub const fn fetch_or(&self, val: $int_type, order: Ordering) -> $int_type;
    pub const fn fetch_xor(&self, val: $int_type, order: Ordering) -> $int_type;
    pub const fn fetch_max(&self, val: $int_type, order: Ordering) -> $int_type;
    pub const fn fetch_min(&self, val: $int_type, order: Ordering) -> $int_type;
}

pub const fn fence(order: Ordering);
pub const fn compiler_fence(order: Ordering);
```

However, this excludes the `fetch_*` and `compare_*` operations on `AtomicPtr`, as that kind of pointer arithmetic is not possible at compile time.

Tracking issue: rust-lang#160078
Cc @rust-lang/wg-const-eval @rust-lang/opsem
Structurally prevent zero-count `BackendRepr::SimdVector`s

This is already *supposed* to be impossible in layout, but this emphasizes that better.  This PR makes no behaviour changes; just `BackendLaneCount` instead of `u64` in https://doc.rust-lang.org/nightly/nightly-rustc/rustc_abi/enum.BackendRepr.html

Ironically I was inspired to do this as part of [looking at making `Simd<T, 0>` *work*](https://rust-lang.zulipchat.com/#narrow/channel/257879-project-portable-simd/topic/Allow.20N.3D.3D0.3F/with/613345298), but importantly if that's going to happen I think it should be `BackendRepr::Memory` like other ZSTs, *not* a `BackendRepr::ScalarVector` that would need to carry around a useless LLVM value in `OperandValue::Immediate` (where it's not even clear what the LLVM type of that value would be).
Make `#[fundamental]` only apply to the first argument of `Box`

Per a [discussion with lang](https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/.60.23.5Bfundamental.5D.60.20and.20.60Box.3CT.2C.20A.3E.60/with/613236766), it was decided that we want `Box<T, A>` to only be fundamental in `T`. ~~Given that `Box` is the only fundamental type with two generic params, simply make it so only the first param is considered for fundamentalness.~~ ~~`Tuple` is also fundamental, but has its own path in coherence checking and so isn't impacted by this; `Box` is the only thing that is.~~

Since this is just an internal detail and `#[fundamental]` is not in a rush to get stabilised, lang's opinion was that t-compiler has free rein on how to implement this so I figured I'd go with the most straightforward implementation for now. The main alternative I see would be supporting param-position `#[fundamental]` & have the semantics that:
```rust
#[fundamental]
struct Foo<T, U>(T, U);
```
is equivalent to
```rust
struct Foo<#[fundamental] T, #[fundamental] U>(T, U);
```
though given that there's no usecase for this right now, it seemed somewhat unnecessary.

r? compiler
Remove an outdated FIXME

This FIXME was added in rust-lang#78923, at which point there were 8 arguments. Now there are only 5, which is much more reasonable.

This commit was brought to you by https://oli-obk.github.io/fixmeh/.
…rochenkov

Improve diagnostic for patterns in function pointer types

In preparation for some work for rust-lang#158499

Diagnostic before:
```
error[E0642]: patterns aren't allowed in methods without bodies
  --> $DIR/fn-ptr-pattern.rs:4:14
   |
LL |     pat2: fn(1..3: bool),
   |              ^^^^
   |
help: give this argument a name or use an underscore to ignore it
   |
LL -     pat2: fn(1..3: bool),
LL +     pat2: fn(_: bool),
   |
```
Diagnostic after:
```
error[E0642]: patterns aren't allowed in function pointer types
  --> $DIR/fn-ptr-pattern.rs:4:14
   |
LL |     pat2: fn(1..3: bool),
   |              ^^^^
   |
help: give this argument a name or use an underscore to ignore it
   |
LL -     pat2: fn(1..3: bool),
LL +     pat2: fn(_: bool),
   |
```
Eagerly fetch typeck results when linting

The first commit avoids running the lint visitor if all lints were filtered out. In every other case the typeck results are accessed on every body making the delayed load pointless overhead.
…it_impls_tuples, r=mejrs

Improve suggestions when multiples tuples implement the same trait

Fixes rust-lang#152903
…ttribute, r=GuillaumeGomez

Add documentation for the `non_exhaustive` attribute

Document the built-in `non_exhaustive` attribute using the `#[doc(attribute = "…")]` mechanism.

Part of rust-lang#157604

Tested with `./x test library/std --doc --test-args attribute_docs`.

r? @GuillaumeGomez
@rustbot rustbot added the WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) label Aug 1, 2026
@jhpratt

jhpratt commented Aug 1, 2026

Copy link
Copy Markdown
Member Author

@bors r+ rollup=never p=5

@bors try jobs=dist-various-1,test-various,x86_64-gnu-aux,x86_64-gnu-llvm-21-3,x86_64-msvc-1,aarch64-apple,x86_64-mingw-1,i686-msvc-*

@rust-bors

rust-bors Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 7f4e4aa has been approved by jhpratt

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 1, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Aug 1, 2026
Rollup of 14 pull requests


try-job: dist-various-1
try-job: test-various
try-job: x86_64-gnu-aux
try-job: x86_64-gnu-llvm-21-3
try-job: x86_64-msvc-1
try-job: aarch64-apple
try-job: x86_64-mingw-1
try-job: i686-msvc-*
@rust-bors

This comment has been minimized.

@rust-bors

rust-bors Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 811f92b (811f92b44431aca590547347883810e2f71bfeaf)
Base parent: 6c04025 (6c04025a8a1d2b4b25283bb56b6c6450e3d38ba7)

@rust-bors rust-bors Bot added merged-by-bors This PR was explicitly merged by bors. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 1, 2026
@rust-bors

rust-bors Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

☀️ Test successful - CI
Approved by: jhpratt
Duration: 3h 15m 33s
Pushing b6a3d79 to main...

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor
What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing cb9d1b0 (parent) -> b6a3d79 (this PR)

Test differences

Show 3207 test diffs

Stage 1

  • arc::new_uninit_slice_capacity_overflow: [missing] -> pass (J1)
  • rc::new_uninit_slice_capacity_overflow: [missing] -> pass (J1)
  • [ui (polonius)] tests/ui/coherence/impl-foreign-for-box[foreign_local].rs: [missing] -> pass (J3)
  • [ui (polonius)] tests/ui/consts/const-eval/atomic.rs: [missing] -> pass (J3)
  • [ui (polonius)] tests/ui/fn/fn-ptr-pattern.rs: [missing] -> pass (J3)
  • [ui (polonius)] tests/ui/suggestions/multiple_tuples_implement_same_trait_continuous_arities.rs: [missing] -> pass (J3)
  • [ui (polonius)] tests/ui/suggestions/multiple_tuples_implement_same_trait_discontinuous_arities.rs: [missing] -> pass (J3)
  • [ui (polonius)] tests/ui/tool-attributes/crate-attr-dup-tool.rs: [missing] -> pass (J3)
  • [ui (polonius)] tests/ui/tool-attributes/cross-crate.rs: [missing] -> pass (J3)
  • [ui] tests/ui/coherence/impl-foreign-for-box[foreign_local].rs: [missing] -> pass (J4)
  • [ui] tests/ui/consts/const-eval/atomic.rs: [missing] -> pass (J4)
  • [ui] tests/ui/fn/fn-ptr-pattern.rs: [missing] -> pass (J4)
  • [ui] tests/ui/suggestions/multiple_tuples_implement_same_trait_continuous_arities.rs: [missing] -> pass (J4)
  • [ui] tests/ui/suggestions/multiple_tuples_implement_same_trait_discontinuous_arities.rs: [missing] -> pass (J4)
  • [ui] tests/ui/tool-attributes/crate-attr-dup-tool.rs: [missing] -> pass (J4)
  • [ui] tests/ui/tool-attributes/cross-crate.rs: [missing] -> pass (J4)

Stage 2

  • [ui] tests/ui/coherence/impl-foreign-for-box[foreign_local].rs: [missing] -> pass (J0)
  • [ui] tests/ui/consts/const-eval/atomic.rs: [missing] -> pass (J0)
  • [ui] tests/ui/fn/fn-ptr-pattern.rs: [missing] -> pass (J0)
  • [ui] tests/ui/suggestions/multiple_tuples_implement_same_trait_continuous_arities.rs: [missing] -> pass (J0)
  • [ui] tests/ui/suggestions/multiple_tuples_implement_same_trait_discontinuous_arities.rs: [missing] -> pass (J0)
  • [ui] tests/ui/tool-attributes/crate-attr-dup-tool.rs: [missing] -> pass (J0)
  • [ui] tests/ui/tool-attributes/cross-crate.rs: [missing] -> pass (J0)
  • arc::new_uninit_slice_capacity_overflow: [missing] -> pass (J2)
  • rc::new_uninit_slice_capacity_overflow: [missing] -> pass (J2)

Additionally, 3182 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard b6a3d7965e2c5de79378a88a3f28a6f1b73fbb16 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. dist-arm-linux-musl: 1h 16m -> 1h 45m (+38.5%)
  2. x86_64-gnu-llvm-22-1: 57m 7s -> 1h 18m (+38.2%)
  3. dist-ohos-aarch64: 1h -> 1h 21m (+34.3%)
  4. i686-msvc-1: 2h 15m -> 3h (+33.7%)
  5. x86_64-gnu-parallel-frontend: 2h 13m -> 1h 32m (-31.0%)
  6. arm-android: 1h 45m -> 1h 13m (-30.1%)
  7. dist-x86_64-illumos: 1h 27m -> 1h 52m (+28.7%)
  8. dist-riscv64-linux-gnu: 1h 31m -> 1h 7m (-26.7%)
  9. dist-i586-gnu-i586-i686-musl: 19m 27s -> 24m 26s (+25.6%)
  10. dist-ohos-x86_64: 1h 17m -> 59m 4s (-24.1%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer

Copy link
Copy Markdown
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#159245 Emit retags in codegen to support BorrowSanitizer (part 5) e51fed5d1991a539fabf02a8a048e2ae8c9c9bcf (link)
#159864 Report "capacity overflow" for oversized Rc<[T]>/Arc<[T]> 336e80b7d2e1e5efa120068b176fce644f040b1d (link)
#160079 make atomic operations const 64c390bf72cdb39dc1001e653e811e2eaf0b1709 (link)
#160124 Structurally prevent zero-count BackendRepr::SimdVectors 08c87c35ba15cca10597589800a452d8dd060570 (link)
#160162 Make #[fundamental] only apply to the first argument of `… 9c9763e0fd3f622de2f1478bc63a97f71d45ad36 (link)
#160210 Remove an outdated FIXME d5d52ab42c3bcb1a7ff573a870192010ddfdf963 (link)
#160282 Improve diagnostic for patterns in function pointer types d0a1b4b2f645577041b23242011eaa239171d841 (link)
#157928 Eagerly fetch typeck results when linting d001d4bbddf16bbbe7c20839152df15a3b453f87 (link)
#159672 Improve suggestions when multiples tuples implement the sam… 7b9f31225f6f9dc241984cdf905ef6a6fb372ad0 (link)
#159861 Add documentation for the non_exhaustive attribute 232e15dc1aef4136f99c14ad0bafb3576123e2ea (link)
#159907 Fix hidden_glob_reexports in rustc_ast da9b07e225c001b621869a1735199081d6679e27 (link)
#159998 Align expect messages with guidance 8132e88b57e0dfd7847382f72f7a58d0451246ff (link)
#160145 Expand checks for register_tool 218e21c590da7fe66c04da13f940726c45678363 (link)
#160307 Update minifier version to 0.4.0 26e02958b01a8275eeb8e91a569921f0c539e413 (link)

previous master: cb9d1b0640

In the case of a perf regression, run the following command for each PR you suspect might be the cause: @rust-timer build $SHA

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (b6a3d79): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.2% [-0.3%, -0.2%] 5
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary 0.8%, secondary 0.5%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.8% [0.8%, 0.8%] 1
Regressions ❌
(secondary)
0.5% [0.4%, 0.7%] 8
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.8% [0.8%, 0.8%] 1

Cycles

Results (primary 0.1%, secondary -0.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
1.0% [0.5%, 1.7%] 6
Regressions ❌
(secondary)
1.3% [0.4%, 4.2%] 7
Improvements ✅
(primary)
-1.2% [-2.9%, -0.4%] 4
Improvements ✅
(secondary)
-3.3% [-14.0%, -0.6%] 5
All ❌✅ (primary) 0.1% [-2.9%, 1.7%] 10

Binary size

Results (primary -0.0%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.0% [-0.0%, -0.0%] 3
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.0% [-0.0%, -0.0%] 3

Bootstrap: 490.618s -> 491.498s (0.18%)
Artifact size: 390.50 MiB -> 390.44 MiB (-0.01%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. merged-by-bors This PR was explicitly merged by bors. rollup A PR which is a rollup T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.