306274 Commits

Author SHA1 Message Date
Stuart Cook
681da13a02
Rollup merge of #146838 - yotamofek:pr/rustdoc/wrappers, r=lolbinarycat
Introduce "wrapper" helpers to rustdoc

Add a few traits for streamlining places where we need to wrap certain `fmt::Display`s in stuff like parentheses or brackets.
Hopefully this makes the actual display logic slightly easier to read.

First two commits are small, unrelated cleanups.

I'll probably add some doc comments to the stuff in `display.rs`, maybe also play around with the API, but wanted to get feedback on this idea first.
2025-09-22 20:25:14 +10:00
Stuart Cook
46be365a60
Rollup merge of #146831 - taiki-e:powerpc-clobber, r=Amanieu
Support ctr and lr as clobber-only registers in PowerPC inline assembly

Follow-up to rust-lang/rust#131341.

CTR and LR are marked as volatile in all ABIs, but I skipped them in rust-lang/rust#131341 due to they are currently marked as reserved.
dd7fda5700/compiler/rustc_target/src/asm/powerpc.rs (L209-L212)

However, they are actually only unusable as input/output of inline assembly, and should be fine to support as clobber-only registers as discussed in [#t-compiler > ppc/ppc64 inline asm support](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/ppc.2Fppc64.20inline.20asm.20support/with/540413845).

r? ````@Amanieu```` or ````@workingjubilee````

cc ````@programmerjake````

````@rustbot```` label +O-PowerPC +A-inline-assembly
2025-09-22 20:25:14 +10:00
Stuart Cook
40db498a0f
Rollup merge of #146791 - folkertdev:readonly-not-pure, r=nikic,joshtriplett
emit attribute for readonly non-pure inline assembly

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

Provide a better `MemoryEffects` to LLVM when an inline assembly block specifies `readonly` but not `pure`. That means that the assembly block may not perform any writes, but that there still may be side effects from its instructions.

I haven't been able to find a case yet where this actually matters, though. So the test checks that the right attribute is applied, but the generated assembly is equivalent to not specifying `readonly` at all.

r? ````@nikic````
cc ````@Amanieu````
2025-09-22 20:25:13 +10:00
Stuart Cook
d144638f89
Rollup merge of #146397 - pthariensflame:patch-1, r=Amanieu
std_detect on Darwin AArch64: update features

Synchronizes the list (and re-sorts it alphabetically by `FEAT` name) with the initial release version of macOS Tahoe.
2025-09-22 20:25:12 +10:00
Stuart Cook
8c0c53791b
Rollup merge of #145411 - the8472:cows-have-no-branches, r=Mark-Simulacrum
regression test for Cow<[u8]> layout

requested by ralf in https://github.com/rust-lang/rust/issues/117763#issuecomment-3126080834
2025-09-22 20:25:12 +10:00
Yotam Ofek
20671600a2 Introduce "wrapper" helpers to rustdoc 2025-09-22 00:28:34 +03:00
Yotam Ofek
cdf96614cf Re-use some existing util fns 2025-09-21 23:54:57 +03:00
Yotam Ofek
c54a953402 Early return in visibility_print_with_space 2025-09-21 23:54:57 +03:00
bors
9f32ccf35f Auto merge of #146862 - matthiaskrgr:rollup-1zqootr, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#143857 (Port #[macro_export] to the new attribute parsing infrastructure)
 - rust-lang/rust#146486 (Improve `core::sync::atomic` coverage)
 - rust-lang/rust#146606 (ci: x86_64-gnu-tools: Add `--test-args` regression test)
 - rust-lang/rust#146639 (std: merge definitions of `StdioPipes`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-09-21 20:33:36 +00:00
Matthias Krüger
adfc111fff
Rollup merge of #146639 - joboet:shared-stdiopipes, r=Mark-Simulacrum
std: merge definitions of `StdioPipes`

All platforms define this structure the same way, so we can just put it in the `process` module directly.
2025-09-21 22:20:27 +02:00
Matthias Krüger
af315d3027
Rollup merge of #146606 - Enselic:test-test-args, r=Mark-Simulacrum
ci: x86_64-gnu-tools: Add `--test-args` regression test

See https://github.com/rust-lang/rust/pull/146601#issuecomment-3293179561

r? ``@Mark-Simulacrum``
2025-09-21 22:20:26 +02:00
Matthias Krüger
c0f5eefa27
Rollup merge of #146486 - ferrocene:pvdrz/improve-atomic-coverage, r=ibraheemdev
Improve `core::sync::atomic` coverage

This PR improves the `core::sync::atomic` coverage by adding new tests to `coretests`.

r? libs
2025-09-21 22:20:26 +02:00
Matthias Krüger
7148a4f543
Rollup merge of #143857 - Periodic1911:macro-export, r=jdonszelmann
Port #[macro_export] to the new attribute parsing infrastructure

Ports macro_export to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197

r? ``@oli-obk``

cc ``@JonathanBrouwer`` ``@jdonszelmann``
2025-09-21 22:20:25 +02:00
Folkert de Vries
3565b0699d
emit attribute for readonly non-pure inline assembly 2025-09-21 21:16:06 +02:00
The 8472
5f0a68eb22 regression test for https://github.com/rust-lang/rust/issues/117763 2025-09-21 19:54:43 +02:00
joboet
87a00f67ba
std: merge definitions of StdioPipes
All platforms define this structure the same way, so we can just put it in the `process` module directly.
2025-09-21 19:45:46 +02:00
bors
7e4b8d702f Auto merge of #146659 - cjgillot:impossible-taint, r=oli-obk
Consider errors in MIR as impossible predicates to empty the body.

The ICEs come from elaborating drops or performing state transform in MIR bodies that fail typeck or borrowck.

If the body is tainted, replace it with `unreachable`.

Fixes https://github.com/rust-lang/rust/issues/122630
Fixes https://github.com/rust-lang/rust/issues/122904
Fixes https://github.com/rust-lang/rust/issues/125185
Fixes https://github.com/rust-lang/rust/issues/139556
2025-09-21 16:28:12 +00:00
Jonathan Brouwer
f7fa83ec62
Changes to uitests for macro_export port
Co-authored-by: Anne Stijns <anstijns@gmail.com>
2025-09-21 10:42:47 -04:00
Jonathan Brouwer
6abcadc235
Port #[macro_export] to the new attribute parsing infrastructure
Co-authored-by: Anne Stijns <anstijns@gmail.com>
2025-09-21 10:42:47 -04:00
bors
6710835ae7 Auto merge of #146592 - Kobzol:tidy-diag, r=jieyouxu
Implement a simple diagnostic system for tidy

In https://github.com/rust-lang/rust/pull/146316 and https://github.com/rust-lang/rust/pull/146580, contributors independently wanted to reduce the verbose output of tidy. But before, the output was quite ad-hoc, so it was not easy to control it.

In this PR, I implemented a simple diagnostic system for tidy, which allows us to:
1) Only print certain information in verbose mode (`-v`)
2) Associate each (error) output to a specific check, so that it is easier to find out what exactly has failed and which check you might want to examine (not fully done, there are some random `println`s left, but most output should be scoped to a specific check)
3) Print output with colors, based on the message level (message, warning, error)
4) Show the start/end execution of each check in verbose mode, for better progress indication

Failure output:
<img width="1134" height="157" alt="image" src="https://github.com/user-attachments/assets/578a9302-e1c2-47e5-9370-a3556c49d9fc" />

Success output:
<img width="388" height="113" alt="image" src="https://github.com/user-attachments/assets/cf27faf8-3d8b-49e3-88d0-fac27a9c36a8" />

Verbose output (shortened):
<img width="380" height="158" alt="image" src="https://github.com/user-attachments/assets/ce7102b8-c2f3-42a8-a2ec-ca30389be91e" />

CC `@nnethercote` `@RalfJung` `@GuillaumeGomez`

The first two commits and the last commit are interesting, the rest is just mechanical port of the code from `bad: &mut bool` to `DiagCtx` and `RunningCheck`.

The `extra_checks` check could be further split, but I'd leave that for another PR.

r? `@jieyouxu`
2025-09-21 13:21:30 +00:00
Jakub Beránek
4c208f5c64
Implement output of colored messages with optional check context 2025-09-21 15:15:31 +02:00
Jakub Beránek
352fa3960a
Migrate the remaining tidy checks to diagnostics 2025-09-21 15:15:31 +02:00
Jakub Beránek
c36faff900
Add CheckId, migrate the alphabetical check to diagnostics 2025-09-21 15:13:01 +02:00
Jakub Beránek
b0010dd5ae
Add diagnostics context and migrate the style check to it 2025-09-21 15:13:01 +02:00
bors
1d23da6b73 Auto merge of #146779 - GuillaumeGomez:gcc-ignore-test_ui_abi, r=Kobzol,jieyouxu
Ignore tests in `tests/ui/abi` for the GCC backend

Needed for https://github.com/rust-lang/rust/pull/146414.

Currently we ignore them in the GCC backend and until this situation changes, it'll block rust-lang/rust#146414.

r? `@Kobzol`
2025-09-21 07:52:56 +00:00
Taiki Endo
f4b876867d Support ctr and lr as clobber-only registers in PowerPC inline assembly 2025-09-21 13:48:22 +09:00
bors
dfa22235d8 Auto merge of #146830 - Zalathar:rollup-lj8jfok, r=Zalathar
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#140983 (Improve doc of some methods that take ranges)
 - rust-lang/rust#144091 (Stabilize `new_zeroed_alloc`)
 - rust-lang/rust#145664 (Stabilize `std::panic::Location::file_as_c_str`)
 - rust-lang/rust#146551 (fix issue with `cmse-nonsecure-entry` ABI being both async and c-variadic)
 - rust-lang/rust#146744 (Deref related cleanups in ref_prop)
 - rust-lang/rust#146793 (naked_asm: emit a label starting with `func_end`)
 - rust-lang/rust#146820 (Add unstable attribute to BTreeMap-related allocator generics)
 - rust-lang/rust#146822 (Fix old typo in lang_start_internal comment)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-09-21 04:45:12 +00:00
Stuart Cook
5224279572
Rollup merge of #146822 - saethlin:bbbbbstd, r=Noratrieb
Fix old typo in lang_start_internal comment

Noticed this when reading the rt cleanup code; the typo was introduced during a mass port of libstd to std in comments.
2025-09-21 14:42:37 +10:00
Stuart Cook
be395723b5
Rollup merge of #146820 - cammeresi:alloc-20250919, r=tgross35
Add unstable attribute to BTreeMap-related allocator generics

Although these types aren't directly constructable externally, since they're pub, I think this omission was an oversight.

r? libs-api
2025-09-21 14:42:36 +10:00
Stuart Cook
92ea947c78
Rollup merge of #146793 - folkertdev:naked-asm-func-end, r=Amanieu
naked_asm: emit a label starting with `func_end`

The `cargo asm` tool (`cargo install cargo-show-asm`) pattern matches on such labels to figure out where functions end: normal functions generated by LLVM always do have such a label. We don't guarantee that naked functions emit such a label, but having `cargo asm` work is convenient.

be45f67454/src/asm/statements.rs (L897-L901)

To make the label name unique it's suffixed with the name of the current symbol.

r? ```@Amanieu```
2025-09-21 14:42:35 +10:00
Stuart Cook
5c1c47925e
Rollup merge of #146744 - beepster4096:derefs_in_ref_prop, r=cjgillot
Deref related cleanups in ref_prop

Cherry picked from rust-lang/rust#146710

r? cjgillot
2025-09-21 14:42:35 +10:00
Stuart Cook
6333a8b9fe
Rollup merge of #146551 - folkertdev:cmse-entry-c-variadic, r=workingjubilee
fix issue with `cmse-nonsecure-entry` ABI being both async and c-variadic

tracking issue: https://github.com/rust-lang/rust/issues/75835
fixes https://github.com/rust-lang/rust/issues/132142

An `extern "cmse-nonsecure-entry"` function cannot be c-variadic (or, in any case, clang/LLVM does not support it, see  https://godbolt.org/z/MaPjzGcE1). So just stop looking at the type if we know it'll be invalid anyway.

I'm not entirely sure how to test this. The ICE is only possible on the `thumbv8m.main-none-eabi` and some related targets. I think using `minicore` is the most convenient, but use of `async` requires quite a long list of lang items to be present. Maybe we want that anyway though? On the other hand, it's extra `minicore` surface that might go out of date.

An alternative is `run-make`, that should work, but is much less convenient. See also [#t-compiler/help > &#96;async fn&#96; and &#96;minicore&#96;](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/.60async.20fn.60.20and.20.60minicore.60/with/539427262).

r? `@ghost`
2025-09-21 14:42:34 +10:00
Stuart Cook
b0c55c8554
Rollup merge of #145664 - Darksonn:stab-file-with-nul, r=Mark-Simulacrum
Stabilize `std::panic::Location::file_as_c_str`

Closes: rust-lang/rust#141727

Nominating this for T-lang as per ```@traviscross```  https://github.com/rust-lang/rust/issues/141727#issuecomment-3201318429
2025-09-21 14:42:34 +10:00
Stuart Cook
7a5819d154
Rollup merge of #144091 - thaliaarchi:stabilize-new-zeroed, r=Mark-Simulacrum
Stabilize `new_zeroed_alloc`

The corresponding `new_uninit` and `new_uninit_slice` functions were stabilized in rust-lang/rust#129401, but the zeroed counterparts were left for later out of a [desire](https://github.com/rust-lang/rust/issues/63291#issuecomment-2161039756) to stabilize only the minimal set. These functions are straightforward mirrors of the uninit functions and well-established. Since no blockers or design questions have surfaced in the past year, I think it's time to stabilize them.

Tracking issue: rust-lang/rust#129396
2025-09-21 14:42:33 +10:00
Stuart Cook
d2533189de
Rollup merge of #140983 - tkr-sh:master, r=ibraheemdev
Improve doc of some methods that take ranges

Some methods that were taking some range in parameter were a bit inconsistent / unclear in the panic documentation.

Here is the recap:
- Replaced "start/end point" by "start/end bound" to be coherent with [`RangeBounds`](https://doc.rust-lang.org/stable/std/ops/trait.RangeBounds.html) naming (it's also easier to understand I think)
- Previously, it was written "_[...] or if the end point is greater than the length of [...]_", but this is not entirely true! Actually, you can have a start bound that is greater than the length, with an end bound that is unbounded and it will also panic. Therefore I think that "_[...] one of the range bound is bounded and greater than the length of [...]_" is better!
- `String` methods weren't mentionning that the method panics if `start_bound > end_bound` but it actually does! It uses `slice::range` which panics when `start > end`.  (https://doc.rust-lang.org/stable/src/alloc/string.rs.html#1932-1934, https://doc.rust-lang.org/stable/src/core/slice/index.rs.html#835-837).
You can also test it with:
```rs
struct MyRange;
impl std::ops::RangeBounds<usize> for MyRange {
    fn start_bound(&self) -> std::ops::Bound<&usize> {
        std::ops::Bound::Included(&3usize)
    }
    fn end_bound(&self) -> std::ops::Bound<&usize> {
        std::ops::Bound::Included(&1usize)
    }
}

fn main() {
    let mut s = String::from("I love Rust!");
    s.drain(MyRange); // panics!
}
```
2025-09-21 14:42:32 +10:00
Camille Gillot
3934fc9eb2 Consider errors in MIR as impossible predicates. 2025-09-21 03:26:21 +00:00
Ben Kimock
5c0cb3af59 Fix old typo in lang_start_internal comment 2025-09-20 18:27:33 -04:00
bors
dd7fda5700 Auto merge of #146812 - matthiaskrgr:rollup-aiap18m, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#144592 (generate list of all variants with `target_spec_enum`)
 - rust-lang/rust#146762 (Fix and provide instructions for running test suite on Apple simulators)
 - rust-lang/rust#146770 (fixes for numerous clippy warnings)
 - rust-lang/rust#146774 (Allow running `x <cmd> <path>` from a different directory)
 - rust-lang/rust#146800 (Fix unsupported `std::sys::thread` after move)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-09-20 16:33:23 +00:00
Guillaume Gomez
fd7f8b2b25 [GCC backend] Ignore failing ui abi tests 2025-09-20 17:58:32 +02:00
Matthias Krüger
48c1249bff
Rollup merge of #146800 - thaliaarchi:fix-move-pal-thread, r=joboet
Fix unsupported `std::sys::thread` after move

Fixes building std for any platform with an unsupported thread abstraction. This includes {aarch64,armv7,x86_64}-unknown-trusty and riscv32im-risc0-zkvm-elf, which explicitly include the unsupported module, and platforms with no PAL.

Bug fix for rust-lang/rust#145177 (std: move thread into sys).

Also fix the `std` build for xtensa, which I incidentally found while looking for an unsupported platform.

r? ``@joboet``
2025-09-20 17:55:05 +02:00
Matthias Krüger
f5725f0182
Rollup merge of #146774 - Kobzol:bootstrap-relative-path, r=jieyouxu
Allow running `x <cmd> <path>` from a different directory

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

r? ``@jieyouxu``
2025-09-20 17:55:05 +02:00
Matthias Krüger
016420a603
Rollup merge of #146770 - hkBst:clippy-fix-10, r=fmease
fixes for numerous clippy warnings
2025-09-20 17:55:04 +02:00
Matthias Krüger
8904ff135f
Rollup merge of #146762 - madsmtm:test-apple-sim, r=jieyouxu
Fix and provide instructions for running test suite on Apple simulators

The following now works:

```sh
./x test --host='' --target aarch64-apple-ios-sim --skip tests/debuginfo
./x test --host='' --target aarch64-apple-tvos-sim --skip tests/debuginfo
./x test --host='' --target aarch64-apple-watchos-sim --skip tests/debuginfo
./x test --host='' --target aarch64-apple-visionos-sim --skip tests/debuginfo
```

I have documented the setup I used [in the `rustc-dev-guide`](https://rustc-dev-guide.rust-lang.org/tests/running.html#testing-on-emulators), it's fairly standard use of `remote-test-server` (with a small fix to library load paths which I've made in the first commit).

I first tried the somewhat simpler `target.aarch64-apple-ios-sim.runner = "xcrun simctl spawn $UDID"`, but that doesn't work as required libraries etc. also need to be copied to the device.

The debuginfo tests fail, I think because the debug info in `.dSYM` isn't available. I am yet unsure exactly how to fix this, either we need to copy that directory to the target as well, or we need to configure `lldb` somehow to read it from the host.

I decided to not add this to our CI, since I suspect we wouldn't gain much from it? Running on the simulator still uses the host Darwin kernel, it's basically just configured to run in another mode with more restricted permissions and different system libraries.

r? jieyouxu
CC ``@simlay,`` you're a lot more familiar with `xcrun simctl` than I.
2025-09-20 17:55:04 +02:00
Matthias Krüger
5f8062bfcc
Rollup merge of #144592 - fee1-dead-contrib:target_spec, r=Noratrieb
generate list of all variants with `target_spec_enum`

This helps us avoid the hardcoded lists elsewhere.

r? ``@Noratrieb``
2025-09-20 17:55:03 +02:00
bors
9f2ef0f14d Auto merge of #146805 - lnicola:sync-from-ra, r=lnicola
`rust-analyzer` subtree update

Subtree update of `rust-analyzer` to 0c62c01aae.

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

r? `@ghost`
2025-09-20 11:17:44 +00:00
tk
ac3c480388 docs: improve doc of some methods w/ ranges 2025-09-20 10:17:56 +00:00
bors
b00998aaa5 Auto merge of #146771 - Kobzol:download-ci-llvm-default-value, r=jieyouxu
Simplify default value of `download-ci-llvm`

Just set it to true, rather than having different default values on CI and locally, and then only deny `true` on our own CI, not elsewhere.

Closes: https://github.com/rust-lang/rust/issues/146768

r? `@jieyouxu`
2025-09-20 08:04:38 +00:00
Laurențiu Nicola
0afd767bac
Merge pull request #20707 from lnicola/bump-rustc
minor: Bump rustc crates once more
2025-09-20 06:50:11 +00:00
Laurențiu Nicola
4d8655e8d0 Bump rustc crates once more 2025-09-20 09:38:53 +03:00
bors
e4b521903b Auto merge of #146621 - cammeresi:peek-20250915, r=Amanieu
Make `PeekMut` generic over the allocator

- plumb in allocator generic
- additional testing

Related: rust-lang/rust#122742
2025-09-20 04:43:19 +00:00