25017 Commits

Author SHA1 Message Date
Jacob Pratt
49eb7810e2
Rollup merge of #145678 - ttajakka:master, r=estebank
Fix typo in docstring

The return type is correct in the source code but incorrect in the docstring.
2025-08-21 01:12:25 -04:00
Jacob Pratt
018568f0cb
Rollup merge of #145673 - Berrysoft:cygwin-fix-flock, r=joshtriplett
Add flock support for cygwin

See discussion: https://github.com/rust-lang/rust/issues/145534#issuecomment-3207265236

cc: ``@jeremyd2019``
2025-08-21 01:12:24 -04:00
Jacob Pratt
1d02056329
Rollup merge of #145593 - RalfJung:unsafepinned-raw_get, r=Mark-Simulacrum
UnsafePinned::raw_get: sync signature with get

This was forgotten in https://github.com/rust-lang/rust/pull/142162.

Tracking issue: https://github.com/rust-lang/rust/issues/125735.
2025-08-21 01:12:20 -04:00
Jacob Pratt
d54aaed392
Rollup merge of #145525 - typesanitizer:vg/doc, r=Mark-Simulacrum
stdlib: Replace typedef -> type alias in doc comment

'typedef' is jargon from C and C++.

Since the Rust reference uses the term [type alias](https://doc.rust-lang.org/reference/items/type-aliases.html),
this patch changes the doc comment in io/error.rs
to also use 'type alias'.
2025-08-21 01:12:19 -04:00
Jacob Pratt
03aa3b8489
Rollup merge of #145415 - a4lg:riscv-implication-to-c, r=Amanieu
std_detect: RISC-V: implement implication to "C"

Just like we implemented relatively complex rules to imply other extensions **from** "C" (and some others), this commit implements implication **to** the "C" extension from others, complying the following text in the ISA Manual (although there's no direct imply/depend references).

> The C extension is the superset of the following extensions:
>
> - Zca
> - Zcf if F is specified (RV32 only)
> - Zcd if D is specified

This is formally verified so that no other extension combinations (*not* in this implementation) can (currently) imply the "C" extension.

Note: this is a `std_detect` change and not main target feature handling.
2025-08-21 01:12:18 -04:00
Jacob Pratt
32824b58e4
Rollup merge of #144758 - QnJ1c2kNCg:master, r=Noratrieb
[Doc] Add links to the various collections

Add a few links to the collections mentioned in the module doc for Collections.
2025-08-21 01:12:14 -04:00
Jacob Pratt
8e62f0f0c3
Rollup merge of #143383 - fee1-dead-contrib:push-mstmlwuskxyy, r=dtolnay
stabilize `const_array_each_ref`

cc rust-lang/rust#133289, needs FCP.
2025-08-21 01:12:13 -04:00
Tuomas Tajakka
f34fa22740
fix: typo
The return type is correct in the source code but incorrect in the docstring
2025-08-20 22:03:26 +03:00
bors
040a98af70 Auto merge of #144086 - clubby789:alloc-zeroed, r=nikic
Pass `alloc-variant-zeroed` to LLVM

Makes use of https://github.com/llvm/llvm-project/pull/138299 (once we pull in a version of LLVM with this attribute). ~~Unfortunately also requires https://github.com/llvm/llvm-project/pull/149336 to work.~~

Closes rust-lang/rust#104847
2025-08-20 17:16:34 +00:00
王宇逸
cadb56d92e Add flock support for cygwin 2025-08-21 01:06:51 +08:00
clubby789
8ea3b09381 Pass alloc-variant-zeroed to LLVM 2025-08-20 17:08:46 +01:00
Jacob Pratt
816f098464
Rollup merge of #145626 - folkertdev:prefetch-fallback, r=Amanieu
add a fallback implementation for the `prefetch_*` intrinsics

related ACP: https://github.com/rust-lang/libs-team/issues/638

The fallback is to just ignore the arguments. That is a valid implementation because this intrinsic is just a hint.

I also added the `miri::intrinsic_fallback_is_spec` annotation, so that miri now supports these operations. A prefetch intrinsic call is valid on any pointer. (specifically LLVM guarantees this https://llvm.org/docs/LangRef.html#llvm-prefetch-intrinsic)

Next, I made the `LOCALITY` argument a const generic. That argument must be const (otherwise LLVM crashes), but that was not reflected in the type.

Finally, with these changes, the intrinsic can be safe and `const` (a prefetch at const evaluation time is just a no-op).

cc `@Amanieu`
r? `@RalfJung`
2025-08-20 00:46:02 -04:00
Jacob Pratt
6e6522980a
Rollup merge of #145622 - tgross35:remove-builtins-patch, r=Mark-Simulacrum
Remove the std workspace patch for `compiler-builtins`

All dependencies of `std` have dropped the crates.io dependency on `compiler-builtins`, so this patch is no longer needed.

Closes: RUST-142265
2025-08-20 00:45:59 -04:00
Jacob Pratt
84c5d20fe7
Rollup merge of #145619 - joshtriplett:use-the-right-core, r=tgross35
`std_detect`: Use `rustc-std-workspace-*` to pull in `compiler-builtins`

https://github.com/rust-lang/rust/pull/145489 changed `std_detect` to no
longer depend on `cfg-if`, which meant it no longer indirectly pulled in
`rustc-std-workspace-core` via `cfg-if`. That caused it to no longer
depend on `compiler-builtins`.

Change `std_detect` to use `rustc-std-workspace-core` and
`rustc-std-workspace-alloc`, to integrate with the rustc workspace. This
also pulls in `compiler-builtins` via `rustc-std-workspace-core`.

Closes: https://github.com/rust-lang/rust/issues/145594
2025-08-20 00:45:58 -04:00
Jacob Pratt
b0600b2326
Rollup merge of #145531 - sayantn:detect-apxf-avx10, r=Amanieu
Add runtime detection for APX-F and AVX10

This was missed in rust-lang/rust#139534 and rust-lang/rust#139675

`@rustbot` label O-x86_64 O-x86_32 A-target-feature
r? `@Amanieu`
2025-08-20 00:45:57 -04:00
Jacob Pratt
9261fcf159
Rollup merge of #145417 - a4lg:riscv-arch-platform-guide-ch2, r=Amanieu
std_detect: RISC-V platform guide documentation

This is practically a revert of a revert, making the commit e907456b2e10622ccd854a3bba8d02ce170b5dbb on `stdarch` come around again with minor fixes, enhancements and adjustments.

An excerpt from the original commit message follows:

Since there's no architectural feature detection on RISC-V (unlike `CPUID` on x86 architectures and some system registers on Arm/AArch64), runtime feature detection entirely depends on the platform-specific facility.

As a result, availability of each feature heavily depends on the platform and its version.

To help users make a decision for feature checking on a RISC-V system, this commit adds a platform guide with minimum supported platform versions.
2025-08-20 00:45:57 -04:00
Jacob Pratt
5a0c9386a2
Rollup merge of #145381 - Gnurou:int_lowest_highest_one, r=jhpratt
Implement feature `int_lowest_highest_one` for integer and NonZero types

Tracking issue: rust-lang/rust#145203

Implement the accepted ACP rust-lang/rust#145203 for methods that find the index of the least significant (lowest) and most significant (highest) set bit in an integer for signed, unsigned, and NonZero types.

Also add unit tests for all these types.
2025-08-20 00:45:56 -04:00
Jacob Pratt
5fa33047a2
Rollup merge of #145006 - ginnyTheCat:docs-skip-until, r=ibraheemdev
Clarify EOF handling for `BufRead::skip_until`

This aligns `BufRead::skip_until`'s description more with `BufRead::read_until` in terms of how it handles EOF and extends the doctest to include this behavior.
2025-08-20 00:45:54 -04:00
Jacob Pratt
a6d648fe79
Rollup merge of #139357 - miried:master, r=Amanieu
Fix parameter order for `_by()` variants of `min` / `max`/ `minmax` in `std::cmp`

We saw a regression introduced in version `1.86` that seems to be coming from switching the order of `v1` and `v2` when calling `comparison` functions in `min_by` / `max_by` / `minmax_by` (cf. this PR: https://github.com/rust-lang/rust/pull/136307)

When the `compare` function is not symmetric in the arguments, this leads to false results. Apparently, the test cases do not cover this scenario currently. While asymmetric comparison may be an edge case, but current behavior is unexpected nevertheless.
2025-08-20 00:45:51 -04:00
bors
f605b57042 Auto merge of #145601 - jieyouxu:rollup-t5mbqhc, r=jieyouxu
Rollup of 10 pull requests

Successful merges:

 - rust-lang/rust#145538 (bufreader::Buffer::backshift: don't move the uninit bytes)
 - rust-lang/rust#145542 (triagebot: Don't warn no-mentions on subtree updates)
 - rust-lang/rust#145549 (Update rust maintainers in openharmony.md)
 - rust-lang/rust#145550 (Avoid using `()` in `derive(From)` output.)
 - rust-lang/rust#145556 (Allow stability attributes on extern crates)
 - rust-lang/rust#145560 (Remove unused `PartialOrd`/`Ord` from bootstrap)
 - rust-lang/rust#145568 (ignore frontmatters in `TokenStream::new`)
 - rust-lang/rust#145571 (remove myself from some adhoc-groups and pings)
 - rust-lang/rust#145576 (Add change tracker entry for `--timings`)
 - rust-lang/rust#145578 (Add VEXos "linked files" support to `armv7a-vex-v5`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-08-19 23:52:06 +00:00
Folkert de Vries
d25910eaeb
make prefetch intrinsics safe 2025-08-20 00:35:42 +02:00
bors
05f5a58e84 Auto merge of #145600 - jieyouxu:rollup-jw0bpnt, r=jieyouxu
Rollup of 15 pull requests

Successful merges:

 - rust-lang/rust#145338 (actually provide the correct args to coroutine witnesses)
 - rust-lang/rust#145429 (Couple of codegen_fn_attrs improvements)
 - rust-lang/rust#145452 (Do not strip binaries in bootstrap everytime if they are unchanged)
 - rust-lang/rust#145464 (Stabilize `const_pathbuf_osstring_new` feature)
 - rust-lang/rust#145474 (Properly recover from parenthesized use-bounds (precise capturing lists) plus small cleanups)
 - rust-lang/rust#145486 (Fix `unicode_data.rs` mention message)
 - rust-lang/rust#145490 (Trace some basic I/O operations in bootstrap)
 - rust-lang/rust#145493 (remove `should_render` in `PrintAttribute` derive)
 - rust-lang/rust#145500 (Port must_use to the new target checking)
 - rust-lang/rust#145505 (Simplify span caches)
 - rust-lang/rust#145510 (Visit and print async_fut local for async drop.)
 - rust-lang/rust#145511 (Rust build fails on OpenBSD after using file_lock feature)
 - rust-lang/rust#145532 (resolve: debug for block module)
 - rust-lang/rust#145533 (Reorder `lto` options from most to least optimizing)
 - rust-lang/rust#145537 (Do not consider a `T: !Sized` candidate to satisfy a `T: !MetaSized` obligation.)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-08-19 19:26:10 +00:00
Folkert de Vries
51df7aabbe
add a fallback implementation for the prefetch_* intrinsics
The fallback is to just ignore the arguments. That is a valid implementation because this intrinsic is just a hint.

I also added `miri::intrinsic_fallback_is_spec` annotation, so that miri now supports these operations. A prefetch intrinsic call is valid on any pointer.
2025-08-19 21:17:49 +02:00
Trevor Gross
988092e9ff Remove the std workspace patch for compiler-builtins
All dependencies of `std` have dropped the crates.io dependency on
`compiler-builtins`, so this patch is no longer needed.

Closes: RUST-142265
2025-08-19 18:56:35 +00:00
Josh Triplett
4c948bc332 Update lockfile for changes to std_detect 2025-08-19 11:46:37 -07:00
Josh Triplett
a971238175 std_detect: Use rustc-std-workspace-* to pull in compiler-builtins
https://github.com/rust-lang/rust/pull/145489 changed `std_detect` to no
longer depend on `cfg-if`, which meant it no longer indirectly pulled in
`rustc-std-workspace-core` via `cfg-if`. That caused it to no longer
depend on `compiler-builtins`.

Change `std_detect` to use `rustc-std-workspace-core` and
`rustc-std-workspace-alloc`, to integrate with the rustc workspace. This
also pulls in `compiler-builtins` via `rustc-std-workspace-core`.

Closes: https://github.com/rust-lang/rust/issues/145594
2025-08-19 11:17:35 -07:00
许杰友 Jieyou Xu (Joe)
bb4af94006
Rollup merge of #145538 - lolbinarycat:std-bufreader-buffer-backshift-less, r=tgross35
bufreader::Buffer::backshift: don't move the uninit bytes

previous code was perfectly sound because of MaybeUninit, but it did waste cycles on copying memory that is known to be uninitialized.
2025-08-19 19:50:01 +08:00
许杰友 Jieyou Xu (Joe)
dc945d9e4c
Rollup merge of #145511 - semarie:push-rnytptsoxrxn, r=joshtriplett
Rust build fails on OpenBSD after using file_lock feature

PR 130999 added the file_lock feature, but doesn't included OpenBSD in the supported targets (Tier 3 platform), leading to a compilation error ("try_lock() not supported").

Cc `@cberner`

Related to rust-lang/rust#130999
2025-08-19 19:45:38 +08:00
许杰友 Jieyou Xu (Joe)
9a5c00a673
Rollup merge of #145464 - Kivooeo:stabilize-const_pathbuf_osstring_new, r=ibraheemdev
Stabilize `const_pathbuf_osstring_new` feature

This closes [tracking issue](https://github.com/rust-lang/rust/issues/141520) and stabilises `{OsString, PathBuf}::new` in const
2025-08-19 19:45:32 +08:00
许杰友 Jieyou Xu (Joe)
5e979cbfc3
Rollup merge of #145336 - clarfonthey:hidden-unicode, r=ibraheemdev
Hide docs for `core::unicode`

This module is perma-unstable and shouldn't show up in the public docs. If people want to see the docs for it, they can still run `RUSTDOCFLAGS=--document-hidden-items ./x doc library/core`.
2025-08-19 19:42:10 +08:00
许杰友 Jieyou Xu (Joe)
0b378a7108
Rollup merge of #145255 - lune-climate:dec2flt-doc, r=ibraheemdev
dec2flt: Provide more valid inputs examples

I was just looking at the specifics of how the parsing is handled here and I wasn't sure if the examples were incomplete or the grammar below was misleading.

The grammar was correct so I figured I'd add these examples to clarify.
2025-08-19 19:42:09 +08:00
许杰友 Jieyou Xu (Joe)
bdd3bc82c8
Rollup merge of #145099 - heiher:loong-32s, r=folkertdev
rustc_target: Add the `32s` target feature for LoongArch

LLVM: https://github.com/llvm/llvm-project/pull/139695
2025-08-19 19:42:08 +08:00
许杰友 Jieyou Xu (Joe)
b4a88c8d07
Rollup merge of #145025 - lolbinarycat:ci-tidy-spellcheck, r=Kobzol
run spellcheck as a tidy extra check in ci

This is probably how it should've been done from the start.

r? ``@Kobzol``
2025-08-19 19:42:07 +08:00
许杰友 Jieyou Xu (Joe)
0b80d406ce
Rollup merge of #144767 - tgross35:doc-grammar, r=ibraheemdev
Correct some grammar in integer documentation

Update "between" to "among" (more than two items), connect the "which" dependent clause to the independent part, and remove the redundant "here".
2025-08-19 19:42:04 +08:00
许杰友 Jieyou Xu (Joe)
4327e69030
Rollup merge of #143730 - pascaldekloe:fmt-radix-trim, r=tgross35
fmt of non-decimal radix untangled

Have the implementation match its decimal counterpart.

* Digit table instead of conversion functions
* Correct buffer size per radix
* Elimination of dead code for negative
* No trait abstraction for integers

#### Original Performance
```
    fmt::write_10ints_bin                                                393.03ns/iter      +/- 1.41
    fmt::write_10ints_hex                                                316.84ns/iter      +/- 1.49
    fmt::write_10ints_oct                                                327.16ns/iter      +/- 0.46
```

#### Patched Performance
```
    fmt::write_10ints_bin                                                392.31ns/iter      +/- 3.05
    fmt::write_10ints_hex                                                302.41ns/iter      +/- 5.48
    fmt::write_10ints_oct                                                322.01ns/iter      +/- 3.82
```

r? tgross35
2025-08-19 19:42:03 +08:00
许杰友 Jieyou Xu (Joe)
9c46cdb43a
Rollup merge of #142938 - lolbinarycat:std-set_permissions_nofollow, r=ibraheemdev
implement std::fs::set_permissions_nofollow on unix

implementation of https://github.com/rust-lang/rust/issues/141607
2025-08-19 19:42:02 +08:00
Michael Rieder
36d309e7b9 Merge remote-tracking branch 'upstream/master' 2025-08-19 11:15:52 +02:00
Michael Rieder
41d8d85549 Remove hs_abs_cmp examples 2025-08-19 11:06:45 +02:00
Ralf Jung
c2e16cbcb4 UnsafePinned::raw_get: sync signature with get 2025-08-19 08:25:09 +02:00
Stuart Cook
f44f963b03
Rollup merge of #145563 - Kobzol:remove-from-from-prelude, r=petrochenkov
Remove the `From` derive macro from prelude

The new `#[derive(From)]` functionality (implemented in https://github.com/rust-lang/rust/pull/144922) caused name resolution ambiguity issues (https://github.com/rust-lang/rust/issues/145524). The reproducer looks e.g. like this:

```rust
mod foo {
    pub use derive_more::From;
}

use foo::*;

#[derive(From)] // ERROR: `From` is ambiguous
struct S(u32);
```

It's pretty unfortunate that it works like this, but I guess that there's not much to be done here, and we'll have to wait for the next edition to put the `From` macro into the prelude. That will probably require https://github.com/rust-lang/rust/pull/139493 to land.

I created a new module in core (and re-exported it in std) called `from`, where I re-exported the `From` macro. I *think* that since this is a new module, it should not have the same backwards incompatibility issue.

Happy to hear suggestions about the naming - maybe it would make sense as `core::macros::from::From`? But we already had a precedent in the `core::assert_matches` module, so I just followed suit.

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

r? ``@petrochenkov``
2025-08-19 14:18:27 +10:00
Stuart Cook
d0fa5c7af7
Rollup merge of #144960 - raoulstrackx:raoul/rte-513-disable_sleep_tests_on_sgx, r=Mark-Simulacrum
[RTE-513] Ignore sleep_until test on SGX

rust-lang/rust#141829 added a test for `sleep_until`: it checks whether its specification holds:
> Puts the current thread to sleep until the specified deadline has passed.

but in SGX there's no secure time source. There's only the ability to request the `insecure_time` from outside of the enclave through a [usercall](https://github.com/fortanix/rust-sgx/blob/master/intel-sgx/fortanix-sgx-abi/src/lib.rs#L590-L592) and the ability to [wait](https://github.com/rust-lang/rust/blob/master/library/std/src/sys/pal/sgx/abi/usercalls/mod.rs#L173-L179) for a certain event or timeout. But both are under the control of an attacker; users should not depend on the accuracy nor correctness of this time. We try to even enforce this by adding a +/-10% time interval to wait usercalls.

The current `thread::sleep_until` implementation uses this `wait` usercall. When a negative randomization interval is added to the timeout passed in `wait`, the test fails. As users should not rely on the correctness of any time inside the enclave, it should be considered an incorrect test on SGX. This PR ignores this test.
2025-08-19 14:18:21 +10:00
Stuart Cook
0671b2fe49
Rollup merge of #142871 - chenyukang:yukang-fix-doc-for-transpose, r=ibraheemdev
Trivial improve doc for transpose

When I saw old doc, I felt a little confused.
Seems it would be clearer this way.
2025-08-19 14:18:17 +10:00
Stuart Cook
027c7a5d85
Rollup merge of #141744 - GrigorenkoPV:ip_from, r=Amanieu
Stabilize `ip_from`

Tracking issue: rust-lang/rust#131360

Stabilizes and const-stabilizes the following APIs:
```rust
// core::net
impl Ipv4Addr {
    pub const fn from_octets(octets: [u8; 4]) -> Ipv4Addr;
}
impl Ipv6Addr {
    pub const fn from_octets(octets: [u8; 16]) -> Ipv6Addr;
    pub const fn from_segments(segments: [u16; 8]) -> Ipv6Addr;
}
```

Closes rust-lang/rust#131360

```@rustbot``` label +needs-fcp
2025-08-19 14:18:15 +10:00
Stuart Cook
2beb54c451
Rollup merge of #140956 - Kixunil:impl-partialeq-str-for-path, r=Amanieu
`impl PartialEq<{str,String}> for {Path,PathBuf}`

This is a revival of #105877

Comparison of paths and strings is expected to be possible and needed e.g. in tests. This change adds the impls os `PartialEq` between strings and paths, both owned and unsized, in both directions.

ACP: https://github.com/rust-lang/libs-team/issues/151
2025-08-19 14:18:14 +10:00
Tsukasa OI
ee7627ee40 std_detect: RISC-V: implement implication to "C"
Just like we implemented relatively complex rules to imply other extensions
**from** "C" (and some others), this commit implements implication
**to** the "C" extension from others, complying the following text
in the ISA Manual (although there's no direct imply/depend references).

> The C extension is the superset of the following extensions:
>
> - Zca
> - Zcf if F is specified (RV32 only)
> - Zcd if D is specified

This is formally verified so that no other extension combinations
(*not* in this implementation) can (currently) imply the "C" extension.
2025-08-19 01:38:27 +00:00
bors
9eb4a26520 Auto merge of #145489 - joshtriplett:cfg-if-not, r=Amanieu
library: Migrate from `cfg_if` to `cfg_select`

Migrate the standard library from using the external `cfg_if` crate to using the now-built-in `cfg_select` macro.

This does not yet eliminate the dependency from `library/std/Cargo.toml`, because while the standard library itself no longer uses `cfg_if`, it also incorporates the `backtrace` crate, which does.

Migration assisted by the following vim command (after selecting the full `cfg_if!` invocation):

```
'<,'>s/\(cfg_if::\)\?cfg_if/cfg_select/ | '<,'>s/^\( *\)} else {/\1}\r\1_ => {/c | '<,'>s/^\( *\)} else if #\[cfg(\(.*\))\] /\1}\r\1\2 => /e | '<,'>s/if #\[cfg(\(.*\))\] {/\1 => {/e
```

This is imperfect, but substantially accelerated the process. This prompts for confirmation on the `} else {` since that can also appear inside one of the arms. This also requires manual intervention to handle any multi-line conditions.
2025-08-18 19:37:33 +00:00
binarycat
aa3008d52e implement std::fs::set_permissions_nofollow on unix 2025-08-18 11:37:19 -05:00
Jakub Beránek
a6a760edaf
Remove the From derive macro from prelude
To avoid backwards compatibility problems.
2025-08-18 13:12:19 +02:00
Alexandre Courbot
73d3d28bed Implement feature int_lowest_highest_one for integer and NonZero types
Implement the accepted ACP for methods that find the index of the least
significant (lowest) and most significant (highest) set bit in an
integer for signed, unsigned, and NonZero types.

Also add unit tests for all these types.
2025-08-18 18:59:44 +09:00
Stuart Cook
211339faa8
Rollup merge of #145476 - alurm:patch-1, r=ibraheemdev
Fix typo in doc for library/std/src/fs.rs#set_permissions

"privalage" -> "privilege".

Was reading the docs and have noticed this.
2025-08-18 15:31:14 +10:00