Commit Graph

7288 Commits

Author SHA1 Message Date
bors
8c07d140e0 Auto merge of #137065 - jhpratt:rollup-ree9mej, r=jhpratt
Rollup of 9 pull requests

Successful merges:

 - #135687 (re-export `FromCoroutine` from `core::iter`)
 - #135813 (CI: split i686-mingw job to three free runners)
 - #136749 (Implement Extend<AsciiChar> for String)
 - #136879 (Add safe new() to NotAllOnes)
 - #136978 (Windows: Update generated bindings)
 - #137028 (mir_build: Clarify some code for lowering `hir::PatExpr` to THIR)
 - #137029 (Remove unnecessary check code in unused_delims)
 - #137056 (made check_argument_compat public for use in miri)
 - #137062 (Forward all default methods for I/O impls)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-02-15 07:52:03 +00:00
Jacob Pratt
ba89ea8add
Rollup merge of #137062 - thaliaarchi:io-optional-methods/write, r=workingjubilee
Forward all default methods for I/O impls

Forward all default methods for `&mut T` and `Box<T>` to the inner `io::Read`, `io::Write`, `io::Seek`, and `io::BufRead` types.
2025-02-15 02:37:33 -05:00
Jacob Pratt
224be79129
Rollup merge of #136978 - ChrisDenton:windows-bindgen, r=Amanieu
Windows: Update generated bindings

Update to windows-bindgen 0.59.

This update is aimed at reducing churn in the future, but means a bit more churn now:

- `bindings.txt` no longer needs us to write the namespace for each item. This is good because it means in the future we won't need to change them if the namespace changes. However, there are a few where we still need to disambiguate due to duplicate items (this is a bug in the upstream metadata).
- The output in `windows-sys.rs` is now sorted. It was mostly sorted before but not intentionally. This should mean future changes are less noisy.

The actual code changes are minimal here. A few types are now `bool` instead of `BOOLEAN`, which is more convenient.
2025-02-15 02:37:30 -05:00
Jacob Pratt
1524b5319a
Rollup merge of #136879 - kornelski:non1, r=Noratrieb
Add safe new() to NotAllOnes

Replaces duplicated `unsafe` code with a single, easier to verify implementation.
2025-02-15 02:37:29 -05:00
Thalia Archibald
11c174006e Forward all default methods for I/O impls 2025-02-14 21:48:12 -08:00
bors
f77247ac59 Auto merge of #136324 - GrigorenkoPV:erf, r=tgross35
Implement `f{16,32,64,128}::{erf,erfc}` (`#![feature(float_erf)]`)

Tracking issue: #136321

try-job: x86_64-gnu-aux
2025-02-15 04:52:50 +00:00
Jubilee
922119b79c
Rollup merge of #136983 - ehuss:misc-2024-prep, r=tgross35
Prepare standard library for Rust 2024 migration

This includes a variety of commits preparing the standard library for migration to Rust 2024.

The actual migration is blocked on a few things, so I wanted to get this out of the way in a relatively digestable PR.
2025-02-14 14:05:24 -08:00
Matthias Krüger
b5fce2ab8e
Rollup merge of #136967 - DaniPopes:io-repeat-fill, r=joboet
Use `slice::fill` in `io::Repeat` implementation

Use the existing `fill` methods on slices instead of manually writing the fill loop.
2025-02-14 16:23:32 +01:00
Matthias Krüger
c21a76fde0
Rollup merge of #136886 - ehuss:remove-prelude-common, r=jhpratt
Remove the common prelude module

This fixes the issues described in https://github.com/rust-lang/rust/issues/136102. Primarily, this resolves some issues with how the documentation for the prelude is generated:

- It avoids showing "unstable" for macros in the prelude that are actually stable.
- Avoids duplication of some pages due to the previous lack of `doc(no_inline)`.
- Makes the different edition preludes consistent, and sets a pattern that can be used by future editions.

We may need to rearrange these modules in the future if we decide to remove anything from the prelude again. If we do, I think we should look into a different solution that avoids the documentation problems.

Closes https://github.com/rust-lang/rust/issues/136102
2025-02-14 16:23:30 +01:00
Matthias Krüger
678ff2a59b
Rollup merge of #136052 - no1wudi:fix, r=workingjubilee
Correct comment for FreeBSD and DragonFly BSD in unix/thread
2025-02-14 16:23:29 +01:00
Kornel
00964aa401
Add safe new to NotAllOnes 2025-02-14 12:00:13 +00:00
Jubilee
dfc235f80c
Rollup merge of #136908 - mustartt:aix-mutex-destory-einval, r=joboet
[AIX] expect `EINVAL` for `pthread_mutex_destroy`

Calling `pthread_mutex_destory` on a mutex initalized with the static initializer macro `PTHREAD_MUTEX_INITIALIZER` will result in `EINVAL` if the mutex is not lock/unlocked prior to calling `pthread_mutex_destroy`.
2025-02-13 21:37:51 -08:00
Pavel Grigorenko
b8f0ed37bd Implement f{16,32,64,128}::{erf,erfc}
Also add
```rust
// #[unstable(feature = "float_gamma", issue = "99842")]
```
to `gamma`-function-related methods on `f16` & `f128`,
as per https://github.com/rust-lang/rust/pull/136324#issuecomment-2626270247
2025-02-14 01:23:16 +03:00
Eric Huss
ef20a1b1f8 std: Apply deprecated_safe_2024 2025-02-13 13:10:28 -08:00
Eric Huss
1b3940f07f std: Apply fixes for tail drop expressions 2025-02-13 13:10:27 -08:00
Eric Huss
1ba59f868a std: Apply rust_2024_incompatible_pat 2025-02-13 13:10:27 -08:00
Eric Huss
7dc9e05742 std: Apply dependency_on_unit_never_type_fallback
This generates a warning of irrefutable patterns. I decided to slightly
tweak the example so the closure returns unit, since the intent wasn't
to show the weird behavior of returning `!`.
2025-02-13 13:10:27 -08:00
Eric Huss
c1791a1b48 std: Apply missing_unsafe_on_extern 2025-02-13 13:10:27 -08:00
Eric Huss
9e60b0e554 std: Apply unsafe_attr_outside_unsafe 2025-02-13 13:10:27 -08:00
bors
a567209daa Auto merge of #134633 - GrigorenkoPV:get_disjoint_mut, r=cuviper
Stabilize `get_many_mut` as `get_disjoint_mut`

Tracking issue: #104642

Closes #104642

FCP completed in https://github.com/rust-lang/rust/issues/104642#issuecomment-2558161073
2025-02-13 21:09:31 +00:00
Eric Huss
b7c975b22e library: Update rand to 0.9.0 2025-02-13 12:20:55 -08:00
DaniPopes
1a3efd27ab
Use slice::fill in io::Repeat implementation
Use the existing `fill` methods on slices instead of manually
writing the fill loop.
2025-02-13 12:23:52 +01:00
Chris Denton
26eeac1a1e
Windows: Update generated bindings to 0.59 2025-02-13 10:32:59 +00:00
Jacob Pratt
f9142b0785
Rollup merge of #136949 - ehuss:wasm-bench-time, r=jhpratt
Fix import in bench for wasm

This import was causing annoying unused import errors when checking the standard library for some wasm targets. The problem is that everything here is disabled if it is wasm32, but this import wasn't cfg'd.
2025-02-13 03:53:33 -05:00
Jacob Pratt
9a26bb1892
Rollup merge of #136945 - samueltardieu:push-rsqlyknnvyqm, r=fmease
Add diagnostic item for `std::io::BufRead`

This will be used in Clippy to detect unbuffered calls to `Read::bytes()`.
2025-02-12 20:10:03 -05:00
Jacob Pratt
de712f9e0a
Rollup merge of #136818 - a1phyr:io_repeat_exact, r=jhpratt
Implement `read*_exact` for `std:io::repeat`

cc #136756
2025-02-12 20:10:01 -05:00
Jacob Pratt
4ce473ccba
Rollup merge of #136699 - joboet:netaddr_from_inner, r=cuviper
std: replace the `FromInner` implementation for addresses with private conversion functions

Having these implementation available crate-wide means that platforms not using sockets for their networking code have to stub out the libc definitions required to support them. This PR moves the conversions to private helper functions that are only available where actually needed.

I also fixed the signature of the function converting from a C socket address to a Rust one: taking a reference to a `sockaddr_storage` resulted in unsound usage inside  `LookupHost::next`, which could create a reference to a structure smaller than `sockaddr_storage`. Thus I've replaced the argument type with a pointer and made the function `unsafe`.
2025-02-12 20:09:59 -05:00
Eric Huss
c91737373a Fix import in bench for wasm 2025-02-12 14:44:30 -08:00
Samuel Tardieu
f8930b44a5 Add diagnostic item for std::io::BufRead
This will be used in Clippy to detect unbuffered calls to
`Read::bytes()`.
2025-02-12 22:22:15 +01:00
joboet
80c60fe783
std: replace the FromInner implementation for addresses with private conversion functions
Having these implementation available crate-wide means that platforms not using sockets for their networking code have to stub out the libc definitions required to support them. This PR moves the conversions to private helper functions that are only available where actually needed.

I also fixed the signature of the function converting from a C socket address to a Rust one: taking a reference to a `sockaddr_storage` resulted in unsound usage inside  `LookupHost::next`, which could create a reference to a structure smaller than `sockaddr_storage`. Thus I've replaced the argument type with a pointer and made the function `unsafe`.
2025-02-12 14:13:35 +01:00
bors
552a959051 Auto merge of #136918 - GuillaumeGomez:rollup-f6h21gg, r=GuillaumeGomez
Rollup of 8 pull requests

Successful merges:

 - #134981 ( Explain that in paths generics can't be set on both the enum and the variant)
 - #136698 (Replace i686-unknown-redox target with i586-unknown-redox)
 - #136767 (improve host/cross target checking)
 - #136829 ([rustdoc] Move line numbers into the `<code>` directly)
 - #136875 (Rustc dev guide subtree update)
 - #136900 (compiler: replace `ExternAbi::name` calls with formatters)
 - #136913 (Put kobzol back on review rotation)
 - #136915 (documentation fix: `f16` and `f128` are not double-precision)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-02-12 12:42:25 +00:00
bors
021fb9c09a Auto merge of #136897 - workingjubilee:revert-unfcped-stab, r=WaffleLapkin
Revert "Stabilize `extended_varargs_abi_support`"

I cannot find an FCP for this, despite it being a stabilization PR which normally means we do an FCP of some kind? It would seem reasonable for _either_ compiler or lang to have FCPed it? I am thus opening a revert PR, which mostly-cleanly applies, so that we can later actually land this properly with a stability report and FCP.

- https://github.com/rust-lang/rust/issues/136896
- https://github.com/rust-lang/rust/pull/116161
- https://github.com/rust-lang/rust/issues/100189
2025-02-12 09:44:30 +00:00
eyelash
4f37b458fc
f128 is quadruple-precision 2025-02-12 09:55:45 +01:00
eyelash
0ca8353651
f16 is half-precision 2025-02-12 09:54:33 +01:00
Henry Jiang
4b086d4711 expect EINVAL for pthread_mutex_destroy for aix 2025-02-12 00:54:00 -05:00
Jubilee Young
cafa646f21 library: amend revert of extended_varargs_abi_support for beta diff
And leave a comment on the unusual `cfg_attr`

Co-authored-by: waffle <waffle.lapkin@gmail.com>
2025-02-11 20:03:56 -08:00
Jubilee Young
d97bde059a Revert "Stabilize extended_varargs_abi_support"
This reverts commit 685f189b43.
2025-02-11 17:22:27 -08:00
Eric Huss
8c24c0a023 Remove the common prelude module
This fixes the issues described in
https://github.com/rust-lang/rust/issues/136102. Primarily, this
resolves some issues with how the documentation for the prelude is
generated:

- It avoids showing "unstable" for macros in the prelude that are
  actually stable.
- Avoids duplication of some pages due to the previous lack of
  `doc(no_inline)`.
- Makes the different edition preludes consistent, and sets a pattern
  that can be used by future editions.

We may need to rearrange these modules in the future if we decide to
remove anything from the prelude again. If we do, I think we should look
into a different solution that avoids the documentation problems.
2025-02-11 13:04:27 -08:00
Matthias Krüger
45a0ec81ea
Rollup merge of #136354 - hkBst:patch-34, r=ibraheemdev
Update docs for impl keyword

This started as a fix for #79878, but also introduces some structure (headings), and elaborates a tiny bit on impl Trait syntax.
2025-02-11 18:04:40 +01:00
Marijn Schouten
166680c480 Update docs for impl keyword 2025-02-11 08:04:32 +01:00
Jacob Pratt
2996cfdcc3
Rollup merge of #136704 - benschulz:patch-1, r=ibraheemdev
Improve examples for file locking

The `lock` and `try_lock` documentation states that "if the file not open for writing, it is unspecified whether this function returns an error." With this change, the examples use `File::create` instead of `File::open`, eliminating the possibility of someone blindly copying code with unspecified behavior.
2025-02-11 01:02:40 -05:00
Thalia Archibald
593c88fc49 Fix long lines which rustfmt fails to format
rustfmt fails to format this match expression, because it has several
long string literals over the maximum line width. This seems to exhibit
rustfmt issues #3863 (Gives up on chains if any line is too long) and
#3156 (Fail to format match arm when other arm has long line).
2025-02-10 18:51:29 -08:00
Matthias Krüger
ad92b850c6
Rollup merge of #136714 - tgross35:update-builtins, r=tgross35
Update `compiler-builtins` to 0.1.146

Exposes the error function so we can expose this in the standard library [1].

[1]: https://github.com/rust-lang/compiler-builtins/pull/753
2025-02-10 16:38:26 +01:00
Benoît du Garreau
321fab4337 Implement read*_exact for std:io::repeat
cc #136756
2025-02-10 13:43:12 +01:00
Jubilee
ffa8a96040
Rollup merge of #136805 - RalfJung:miri-win-delete-self, r=Noratrieb
ignore win_delete_self test in Miri

Follow-up to https://github.com/rust-lang/rust/pull/134679, fixes miri-test-libstd on Windows

Cc `@ChrisDenton` `@Mark-Simulacrum`
2025-02-10 00:51:58 -08:00
Jubilee
72f0205d28
Rollup merge of #136705 - compiler-errors:edition-library, r=jhpratt
Some miscellaneous edition-related library tweaks

Some library edition tweaks that can be done separately from upgrading the whole standard library to edition 2024 (which is blocked on getting the submodules upgraded, for example)
2025-02-10 00:51:54 -08:00
Jubilee
f471ce39fb
Rollup merge of #136552 - ChrisDenton:option-find-handle, r=Mark-Simulacrum
Use an `Option` for `FindNextFileHandle` in `ReadDir` instead of `INVALID_FILE_HANDLE` sentinel value

Sometimes we store an invalid handle when we don't want to return an error. We then check the handle before use in order to avoid actually using the invalid handle. However, using an `Option` for this is better and avoids us forgetting to check the handle is valid. This was noticed due to us closing the handle without checking for validity: bd6a6777f5/library/std/src/sys/pal/windows/fs.rs (L148-L151)
2025-02-10 00:51:53 -08:00
Ralf Jung
2f3c943f42 ignore win_delete_self test in Miri 2025-02-10 08:08:32 +01:00
Michael Goulet
4312d7b541 Fix pattern matching mode changes and unsafe_op_in_unsafe_fn 2025-02-09 17:11:13 +00:00
Michael Goulet
a4e7f8f9bf Mark extern blocks as unsafe 2025-02-09 17:11:13 +00:00