9657 Commits

Author SHA1 Message Date
yukang
affaf532f9 referring to repeat_n in std::iter::repeat 2025-10-09 01:25:32 +08:00
Julien Cretin
594f9c6c4f Clarify how to remediate the panic_immediate_abort error
Users who build `core` for the sole purpose of enabling `panic_immediate_abort` might expect
"`panic_immediate_abort` is now a real panic strategy" to mean that setting `panic =
"immediate-abort"` in `Cargo.toml` or `-Cpanic=immediate-abort` in `RUSTFLAGS` to be sufficient for
migration. But this is not the case, `core` still needs to be built for those changes to take
effect.

See https://github.com/rust-lang/rust/issues/146974 for additional context.
2025-10-08 11:35:39 +02:00
bors
d62f33a7c6 Auto merge of #147449 - matthiaskrgr:rollup-njyi5yr, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#145943 (stdlib docs: document lifetime extension for `format_args!`'s arguments)
 - rust-lang/rust#147243 (cmse: disallow `impl Trait` in `cmse-nonsecure-entry` return types)
 - rust-lang/rust#147402 ([rustdoc] Don't serialize & deserialize data that doesn't go OTW)
 - rust-lang/rust#147418 (Fix target list of `link_section`)
 - rust-lang/rust#147429 (Print tip for human error format in runtest)
 - rust-lang/rust#147441 (Fix comments error for Provenance impls)
 - rust-lang/rust#147442 (c-variadic: fix thir-print for `...` without a pattern)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-07 17:37:56 +00:00
Marijn Schouten
d52744e9fc iter repeat: panic on last 2025-10-07 16:43:48 +00:00
Matthias Krüger
bce59abf1e
Rollup merge of #145943 - dianne:format-args-assign-docs, r=joboet
stdlib docs: document lifetime extension for `format_args!`'s arguments

Since rust-lang/rust#140748 is stable and rust-lang/rust#92698 is closed, the section about `format_args!`'s argument lifetime limitation is outdated. I've updated it to point to the Reference docs, which will specify lifetime extension rules for builtin macros once rust-lang/reference#1980 or equivalent is merged.

I've also taken the liberty of updating one of the doctests to assign the result of `format_args!` to a variable, both to provide an example and because I think it reads a little better.

r? `@m-ou-se`
2025-10-07 17:42:10 +02:00
Samuel Tardieu
a11fe5d389 Add diagnostic items for pub mod consts of FP types
They will be used in Clippy.
2025-10-06 23:59:20 +02:00
Nathaniel McCallum
04c2724866 constify basic Clone impls 2025-10-06 08:39:41 -04:00
The 8472
ff91dbd1fd only call polymorphic array iter drop machinery when the type requires it 2025-10-05 21:03:30 +02:00
Alice Ryhl
76dcb39c24 Adjust error messages 2025-10-05 17:45:27 +00:00
Alice Ryhl
f65250b3dd Document workaround in docs 2025-10-05 17:45:27 +00:00
Alice Ryhl
cd44cd0f63 Improve docs for module 2025-10-05 17:45:27 +00:00
Alice Ryhl
7e1c00dbce Prevent downstream impl DerefMut for Pin<LocalType> 2025-10-05 17:45:24 +00:00
Stuart Cook
a0a4905723
Rollup merge of #147349 - saethlin:panic-immediate-advice, r=Noratrieb
Improve the advice given by panic_immediate_abort

Now that https://github.com/rust-lang/rust/pull/147338 is merged, users should consider using the Cargo support for immediate-aborting panics.
2025-10-05 15:35:05 +11:00
Stuart Cook
80759350c7
Rollup merge of #147337 - ada4a:write-diag-item, r=fmease
Make `fmt::Write` a diagnostic item

I'm working on an enhancement to [`clippy::format_push_string`](https://rust-lang.github.io/rust-clippy/master/index.html#format_push_string), which would suggest an autofix to replace `push_str`/`+=` with `write!`. But that could require importing `std::fmt::Write`, and so I need this diagnostic item to check if it's already in scope.

The reason I called it `FmtWrite` and not just `Write` is that there's already an `IoWrite` defined.
2025-10-05 15:35:04 +11:00
Ben Kimock
b5fb01d67d Improve the advice given by panic_immediate_abort 2025-10-04 15:53:00 -04:00
Matthias Krüger
18388b8420
Rollup merge of #146479 - Qelxiros:mem_conjure_zst, r=scottmcm,tgross35
add mem::conjure_zst

Tracking issue: rust-lang/rust#95383
2025-10-04 17:11:10 +02:00
Matthias Krüger
dbc1e82f25
Rollup merge of #146330 - Marcondiro:unicode-17, r=Manishearth
Bump unicode_data and printables to version 17.0.0

Unicode 17 ~~is not stable yet (release planned for 2025-09-09).~~ [has been released!](https://www.unicode.org/versions/Unicode17.0.0/)

Update Unicode data and printables to [Unicode 17](https://www.unicode.org/versions/Unicode17.0.0/)
2025-10-04 17:11:09 +02:00
Matthias Krüger
47bd38c2f1
Rollup merge of #145685 - Qelxiros:cell_get_cloned, r=programmerjake,tgross35
add CloneFromCell and Cell::get_cloned

Tracking issue: rust-lang/rust#145329
2025-10-04 17:11:08 +02:00
Ada Alakbarova
2688f601dd
Make fmt::Write a diagnostic item 2025-10-04 16:07:06 +02:00
Jeremy Smart
a9ab29cdb4
add mem::conjure_zst 2025-10-03 13:30:47 -04:00
Jeremy Smart
08b4641f50
add CloneFromCell and Cell::get_cloned 2025-10-01 18:47:09 -04:00
Matthias Krüger
4b905f9cb0
Rollup merge of #147204 - camsteffen:array-windows-ref, r=joboet
Refactor ArrayWindows to use a slice

[Tracking issue](https://github.com/rust-lang/rust/issues/75027)
2025-10-01 18:42:36 +02:00
Cameron Steffen
5ade7647b7 Change ArrayWindows to use a slice 2025-10-01 08:03:19 -05:00
Stuart Cook
5373eb1268
Rollup merge of #146979 - npmccallum:nanosecs, r=Mark-Simulacrum
constify Default on Nanoseconds
2025-09-29 11:56:42 +10:00
Noa
93c8bf1309
Remove F: Fn bound from FromFn struct 2025-09-28 11:44:09 -05:00
Noa
f8d7b41204
Reword docs slightly 2025-09-28 11:43:51 -05:00
Noa
8537abbaf2
Stabilize fmt::{from_fn, FromFn} under feature fmt_from_fn 2025-09-28 11:43:50 -05:00
Matthias Krüger
750e902a75
Rollup merge of #146675 - Jules-Bertholet:sync-nonexclusive, r=Mark-Simulacrum
Allow shared access to `Exclusive<T>` when `T: Sync`

Addresses libs-api request in https://github.com/rust-lang/rust/issues/98407#issuecomment-3299348713.

Adds the following trait impls to `Exclusive<T>`, all bounded on `T: Sync`:

- `AsRef<T>`
- `Clone`
- `Copy`
- `PartialEq`
- `StructuralPartialEq`
- `Eq`
- `Hash`
- `PartialOrd`
- `Ord`
- `Fn`

``@rustbot`` label T-libs-api
2025-09-28 18:13:12 +02:00
Matthias Krüger
641bedabb1
Rollup merge of #147095 - fmease:libprivrepr, r=dtolnay
Library: Remove remaining private `#[repr]` workarounds

With https://github.com/rust-lang/rust/pull/116882 finally merged, gating these `repr`s behind cfg `not(doc)` is no longer necessary to achieve a private repr.

Follow up to https://github.com/rust-lang/rust/pull/128046 (that was enabled via https://github.com/rust-lang/rust/pull/115439). With that, https://github.com/rust-lang/rust/pull/116743 is now fully realized at long last.

cc ``@dtolnay``
2025-09-28 09:15:29 +02:00
Matthias Krüger
ad864de2c3
Rollup merge of #147082 - danielverkamp:fmt-alternate-octal-binary-mixup, r=Noratrieb
formatting_options: fix alternate docs 0b/0o mixup

The descriptions of the alternate forms of Octal and Binary were swapped in the doc comment for FormattingOptions::alternate().
2025-09-28 09:15:27 +02:00
Matthias Krüger
bd2e18671d
Rollup merge of #147076 - joshuarayton:more-float-constants-issue, r=tgross35
update issue number for more_float_constants

Update issue number from https://github.com/rust-lang/rust/issues/103883 to https://github.com/rust-lang/rust/issues/146939

r? ``@tgross35``
2025-09-27 21:26:00 +02:00
Matthias Krüger
01c17f83cf
Rollup merge of #146037 - aapoalas:reborrow-lang-experiment, r=tmandry
Introduce CoerceShared lang item and trait, and basic Reborrow tests

Part of rust-lang/rust#145612: This introduces the `CoerceShared` trait which is the `Reborrow` equivalent of a `&mut T` -> `&T` coercion. The trait has a `Target` GAT which makes this (currently) unique in the `core/src/marker.rs`; I'm not sure if this can be considered problematic. Maybe this is not the way such things should be done at the marker trait level? Or maybe it is fine.

Improtantly, this PR introduces a battery of basic `Reborrow` and `CoerceShared` tests. These test the very basics of the feature; custom marker types intended to have exclusive semantics (`Custom<'a>(PhantomData<&'a mut ()>)`), custom exclusive reference wrappers, and standard library exclusive reference wrappers (`Pin<&mut T>` and `Option<&mut T>`). None of these of course work since the implementation for `Reborrow` and `CoerceShared` is entirely missing, but this is the first step towards making these work.

Future PRs will introduce more tests, such as "recursive" reborrowing (ie. reborrowing structs that contain multiple reborrowable fields) and checks around the lifetime semantics of reborrowing ie. that a reborrow produces a new type with the same lifetime as the original.
2025-09-27 21:25:56 +02:00
León Orell Valerian Liehr
35e582f982
Library: Remove remaining private #[repr] workarounds
Co-authored-by: David Tolnay <dtolnay@gmail.com>
2025-09-27 17:09:01 +02:00
Guillaume Gomez
254a2139f6 Remove cfg(bootstrap) for doc_cfg feature following #141925 2025-09-27 11:29:49 +02:00
Guillaume Gomez
fccba2c341 Remove doc_cfg_hide feature 2025-09-27 11:29:49 +02:00
Guillaume Gomez
7c00bccd3b Implement RFC 3631 2025-09-27 11:29:48 +02:00
Daniel Verkamp
97f64374a9 formatting_options: fix alternate docs 0b/0o mixup
The descriptions of the alternate forms of Octal and Binary were swapped
in the doc comment for FormattingOptions::alternate().
2025-09-26 16:32:54 -07:00
Mark Rousskov
4e9716fbc5 Update CURRENT_RUSTC_VERSION post-bump 2025-09-26 18:41:32 -04:00
Aapo Alasuutari
e88fa086fb move Reborrow to ops, fix fmt issues 2025-09-27 01:11:01 +03:00
Joshua Rayton
2e904c4d07
update issue number for more_float_constants 2025-09-26 18:35:29 +01:00
bors
7ac0330c6d Auto merge of #147037 - matthiaskrgr:rollup-xtgqzuu, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#116882 (rustdoc: hide `#[repr]` if it isn't part of the public ABI)
 - rust-lang/rust#135771 ([rustdoc] Add support for associated items in "jump to def" feature)
 - rust-lang/rust#141032 (avoid violating `slice::from_raw_parts` safety contract in `Vec::extract_if`)
 - rust-lang/rust#142401 (Add proper name mangling for pattern types)
 - rust-lang/rust#146293 (feat: non-panicking `Vec::try_remove`)
 - rust-lang/rust#146859 (BTreeMap: Don't leak allocators when initializing nodes)
 - rust-lang/rust#146924 (Add doc for `NonZero*` const creation)
 - rust-lang/rust#146933 (Make `render_example_with_highlighting` return an `impl fmt::Display`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-09-25 20:35:49 +00:00
Matthias Krüger
781f71a6fe
Rollup merge of #146924 - cptpiepmatz:doc-nonzero-const-creation, r=joboet
Add doc for `NonZero*` const creation

I ran into trouble using `NonZero*` values because I didn’t see any clear way to create them at compile time. At first I ended up using `NonZero*::new_unchecked` a lot, until I realized that `Option::unwrap` and `Option::expect` are `const` and can be used in a `const` context. With that, you can create non-zero values at compile time safely, without touching `unsafe`. This wasn’t obvious to me and my peers who’ve been using Rust for a while, so I thought adding a note to the docs would make it easier for others to discover.

If this should be worded differently or placed in another location, we can do that. I just want to make this more obvious.
2025-09-25 18:15:10 +02:00
Tim 'Piepmatz' Hesse
185ae698aa add doc for NonZero* const creation 2025-09-25 17:52:24 +02:00
bors
6f34f4ee07 Auto merge of #147019 - Zalathar:rollup-boxzbmo, r=Zalathar
Rollup of 14 pull requests

Successful merges:

 - rust-lang/rust#145067 (RawVecInner: add missing `unsafe` to unsafe fns)
 - rust-lang/rust#145277 (Do not materialise X in [X; 0] when X is unsizing a const)
 - rust-lang/rust#145973 (Add `std` support for `armv7a-vex-v5`)
 - rust-lang/rust#146667 (Add an attribute to check the number of lanes in a SIMD vector after monomorphization)
 - rust-lang/rust#146735 (unstably constify float mul_add methods)
 - rust-lang/rust#146737 (f16_f128: enable some more tests in Miri)
 - rust-lang/rust#146766 (Add attributes for #[global_allocator] functions)
 - rust-lang/rust#146905 (llvm: update remarks support on LLVM 22)
 - rust-lang/rust#146982 (Remove erroneous normalization step in `tests/run-make/linker-warning`)
 - rust-lang/rust#147005 (Small string formatting cleanup)
 - rust-lang/rust#147007 (Explicitly note `&[SocketAddr]` impl of `ToSocketAddrs`)
 - rust-lang/rust#147008 (bootstrap.py: Respect build.jobs while building bootstrap tool)
 - rust-lang/rust#147013 (rustdoc: Fix documentation for `--doctest-build-arg`)
 - rust-lang/rust#147015 (Use `LLVMDisposeTargetMachine`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-09-25 14:03:21 +00:00
Stuart Cook
8e62f95376
Rollup merge of #146735 - Qelxiros:const_mul_add, r=tgross35,RalfJung
unstably constify float mul_add methods

Tracking issue: rust-lang/rust#146724
r? `@tgross35`
2025-09-25 20:31:54 +10:00
bors
7cfd7d328b Auto merge of #147003 - matthiaskrgr:rollup-b5z9uiz, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#146556 (Fix duration_since panic on unix when std is built with integer overflow checks)
 - rust-lang/rust#146679 (Clarify Display for error should not include source)
 - rust-lang/rust#146753 (Improve the pretty print of UnstableFeature clause)
 - rust-lang/rust#146894 (Improve derive suggestion of const param)
 - rust-lang/rust#146950 (core: simplify `CStr::default()`)
 - rust-lang/rust#146958 (Fix infinite recursion in Path::eq with String)
 - rust-lang/rust#146971 (fix ICE in writeback due to bound regions)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-09-25 10:30:50 +00:00
Matthias Krüger
6618ac7bb1
Rollup merge of #146950 - joboet:cstr_default, r=tgross35
core: simplify `CStr::default()`

Just use a `CStr`-literal...
2025-09-24 23:33:27 +02:00
Jeremy Smart
a00f24116e
unstably constify float mul_add methods
Co-authored-by: Ralf Jung <post@ralfj.de>
2025-09-24 15:21:31 -04:00
Stepan Koltsov
a9554b4d5f Clarify Display for error should not include source 2025-09-24 20:02:35 +01:00
Matthias Krüger
2320fc3a38
Rollup merge of #146915 - clarfonthey:safe-intrinsics-2, r=RalfJung
Make missed precondition-free float intrinsics safe

So, in my defence, these were both separated out from the other intrinsics in the file *and* had a different safety comment in the stable versions, so, I didn't notice them before. But, in my offence, the entire reason I did the previous PR was because I was using them for SIMD intrinsic fallbacks, and `fabs` is needed for those too, so, I don't really have an excuse.

Extra follow-up to rust-lang/rust#146683.

r? ```@RalfJung``` who reviewed the previous one

These don't appear to be used anywhere outside of the standard locations, at least.
2025-09-24 20:34:22 +02:00