Commit Graph

7177 Commits

Author SHA1 Message Date
Matthias Krüger
48aede0773
Rollup merge of #134272 - RalfJung:destabilize-rustc_encodable_decodable, r=oli-obk
Remove rustc_encodable_decodable feature

This has been shown in future-compat reports since Rust 1.79 (https://github.com/rust-lang/rust/pull/116016), released June 2024. Let's see if crater still finds any issues.

Part of https://github.com/rust-lang/rust/issues/134301.

Cc ``@rust-lang/libs-api``
2025-02-02 18:05:22 +01:00
Matthias Krüger
555dd6fe76
Rollup merge of #136133 - hkBst:patch-23, r=ibraheemdev
Fix sentence in process::abort
2025-02-02 12:31:55 +01:00
Matthias Krüger
cbcb695f9e
Rollup merge of #136360 - slanterns:once_wait, r=tgross35
Stabilize `once_wait`

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

`@rustbot` label: +T-libs-api

r? libs-api
2025-02-01 16:41:04 +01:00
Matthias Krüger
9dfdef618c
Rollup merge of #135684 - ranger-ross:mutex-docs, r=joboet
docs: Documented Send and Sync requirements for Mutex + MutexGuard

This an attempt to continue where #123225 left off.

I did some light clean up from the work done in that PR.
I also documented the `!Send` + `Sync` implementations for `MutexGuard` to the best of my knowledge.
Let me know if I got anything wrong 😄

fixes #122856

cc: ``@IoaNNUwU``

r? ``@joboet``
2025-02-01 16:41:03 +01:00
Marijn Schouten
06171066d2 Fix sentence in process::abort 2025-02-01 13:32:01 +01:00
Ross Sullivan
3d84a49c37
docs: Documented Send and Sync requirements for Mutex + MutexGuard 2025-02-01 14:20:03 +09:00
Slanterns
6fa6168e71
stabilize once_wait 2025-02-01 02:10:02 +08:00
Matthias Krüger
867317835d
Rollup merge of #136288 - joshtriplett:would-you-could-you-with-some-locks--would-you-could-you-in-some-docs, r=m-ou-se
Improve documentation for file locking

Add notes to each method stating that locks get dropped on close.

Clarify the return values of the try methods: they're only defined if
the lock is held via a *different* file handle/descriptor. That goes
along with the documentation that calling them while holding a lock via
the *same* file handle/descriptor may deadlock.

Document the behavior of unlock if no lock is held.

r? `@m-ou-se`
(Documentation changes requested in https://github.com/rust-lang/rust/issues/130994 .)
2025-01-30 20:47:09 +01:00
Matthias Krüger
55c7a02a8b
Rollup merge of #135475 - Ayush1325:uefi-absolute-path, r=jhpratt
uefi: Implement path

This PR is split off from https://github.com/rust-lang/rust/pull/135368 to reduce noise.

UEFI paths can be of 4 types:
1. Absolute Shell Path: Uses shell mappings
2. Absolute Device Path: this is what we want
3. Relative root: path relative to the current root.
4. Relative

Absolute shell path can be identified with `:` and Absolute Device path can be identified with `/`. Relative root path will start with `\`.

The algorithm is mostly taken from edk2 UEFI shell implementation and is somewhat simple. Check for the path type in order.

For Absolute Shell path, use `EFI_SHELL->GetDevicePathFromMap` to get a BorrowedDevicePath for the volume.

For Relative paths, we use the current working directory to construct the new path.

BorrowedDevicePath abstraction is needed to interact with `EFI_SHELL->GetDevicePathFromMap` which returns a Device Path Protocol with the lifetime of UEFI shell.

Absolute Shell paths cannot exist if UEFI shell is missing.

cc `@nicholasbishop`
2025-01-30 20:47:04 +01:00
Josh Triplett
fb1ad2fe02 Improve documentation for file locking
Add notes to each method stating that locks get dropped on close.

Clarify the return values of the try methods: they're only defined if
the lock is held via a *different* file handle/descriptor. That goes
along with the documentation that calling them while holding a lock via
the *same* file handle/descriptor may deadlock.

Document the behavior of unlock if no lock is held.
2025-01-30 11:48:26 +01:00
bors
0cc4f4f7b8 Auto merge of #136248 - matthiaskrgr:rollup-leaxgfd, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #133382 (Suggest considering casting fn item as fn pointer in more cases)
 - #136092 (Test pipes also when not running on Windows and Linux simultaneously)
 - #136190 (Remove duplicated code in RISC-V asm bad-reg test)
 - #136192 (ci: remove unused windows runner)
 - #136205 (Properly check that array length is valid type during built-in unsizing in index)
 - #136211 (Update mdbook to 0.4.44)
 - #136212 (Tweak `&mut self` suggestion span)
 - #136214 (Make crate AST mutation accessible for driver callback)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-01-29 16:18:29 +00:00
Matthias Krüger
da7980b315
Rollup merge of #136092 - tbu-:pr_io_pipe_test, r=joboet
Test pipes also when not running on Windows and Linux simultaneously

Fixes https://github.com/rust-lang/rust/pull/135635#pullrequestreview-2574184488.

Based on top of #135635 to avoid merge conflicts.
2025-01-29 15:29:30 +01:00
León Orell Valerian Liehr
7e60f276ce
Rollup merge of #136186 - Ayush1325:uefi-process-args-fix, r=nicholasbishop,Noratrieb
uefi: process: Fix args

- While working on process env support, I found that args were currently broken. Not sure how I missed it in the PR, but well here is the fix.
- Additionally, no point in adding space at the end of args.
2025-01-29 06:03:25 +01:00
Ayush Singh
9c4fd25f27
uefi: process: Fix args
- While working on process env support, I found that args were currently
  broken. Not sure how I missed it in the PR, but well here is the fix.
- Additionally, no point in adding space at the end of args.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-01-28 19:10:28 +05:30
Matthias Krüger
9a192b254c
Rollup merge of #136012 - hkBst:patch-22, r=workingjubilee,tgross35
Document powf and powi values that are always 1.0

fixes bug #90429
2025-01-28 14:23:25 +01:00
Marijn Schouten
3d6c6fa04e Document powf and powi calls that always return 1.0 2025-01-28 08:24:39 +01:00
Guillaume Gomez
4d5c8bdc9d
Rollup merge of #135876 - usamoi:mpmc-doc, r=tgross35
fix doc for std::sync::mpmc

fix document of `std::sync::mpmc` (tracked in https://github.com/rust-lang/rust/issues/126840)
2025-01-27 15:38:25 +01:00
usamoi
05364239a8 fix doc for std::sync::mpmc 2025-01-27 11:42:16 +08:00
León Orell Valerian Liehr
2949f2a5ef
Rollup merge of #135635 - tbu-:pr_io_pipe, r=joboet
Move `std::io::pipe` code into its own file

Also update the docs for the new location, create a section "Platform-specific behavior", don't hide required imports for code examples.
2025-01-27 04:34:51 +01:00
bors
15c6f7e1a3 Auto merge of #136087 - jhpratt:rollup-tam1mzn, r=jhpratt
Rollup of 7 pull requests

Successful merges:

 - #133631 (Support QNX 7.1 with `io-sock`+libstd and QNX 8.0 (`no_std` only))
 - #134358 (compiler: Set `target_abi = "ilp32e"` on all riscv32e targets)
 - #135812 (Fix GDB `OsString` provider on Windows )
 - #135842 (TRPL: more backward-compatible Edition changes)
 - #135946 (Remove extra whitespace from rustdoc breadcrumbs for copypasting)
 - #135953 (ci.py: check the return code in `run-local`)
 - #136019 (Add an `unchecked_div` alias to the `Div<NonZero<_>>` impls)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-01-26 12:10:05 +00:00
Tobias Bucher
93d347d7d2 Test pipes also when not running on Windows and Linux simultaneously
Fixes https://github.com/rust-lang/rust/pull/135635#pullrequestreview-2574184488.
2025-01-26 12:48:33 +01:00
Tobias Bucher
ad28cbb423 Update std::io::{pipe, PipeReader, PipeWriter} docs the new location
Also create a section "Platform-specific behavior", don't hide required
imports for code examples.
2025-01-26 12:42:52 +01:00
Tobias Bucher
68e983fcf7 Move std::io::pipe code into its own file 2025-01-26 12:40:36 +01:00
Jacob Pratt
0d0e841594
Rollup merge of #133631 - flba-eb:add_nto_qnx71_iosock_support, r=workingjubilee
Support QNX 7.1 with `io-sock`+libstd and QNX 8.0 (`no_std` only)

Changes of this pull request:

1. Refactor code for qnx nto targets to share more code in file `nto_qnx.rs`
1. Add support for an additional network stack on nto qnx 7.1.

   QNX 7.1 supports two network stacks:

   1. `io-pkt`, which is default
   2. `io-sock`, which is optional on 7.1 but default in QNX 8.0

   As one can see in the [io-sock migration notes](https://www.qnx.com/developers/docs/7.1/index.html#com.qnx.doc.neutrino.io_sock/topic/migrate_app.html), this changes the libc API in a way similar to e.g. linux-gnu vs. linux-musl.

   This change adds a new target which has a different value for `target_env`, so that e.g. libc can distinguish between both APIs.

2. Add initial support for QNX 8.0, thanks to AkhilTThomas. As it turned out, the problem with forking many processes still exists in QNX 8.0. Because if this, we are now using it for any QNX version (i.e. not check for `target_env` anymore).
2025-01-26 01:51:14 -05:00
Jacob Pratt
b58221ec9d
Rollup merge of #135948 - bjorn3:update_emscripten_std_tests, r=Mark-Simulacrum
Update emscripten std tests

This disables a bunch of emscripten tests that test things emscripten doesn't support and re-enables a whole bunch of tests which now work just fine on emscripten.

Tested with `EMCC_CFLAGS="-s MAXIMUM_MEMORY=2GB" ./x.py test library/ --target wasm32-unknown-emscripten`.
2025-01-25 23:27:00 -05:00
Josh Triplett
687607c31e Improve and expand documentation of pipes
- Simplify some of the language
- Minor grammar fixes
- Don't imply that pipes *only* work across multiple processes; instead,
  *suggest* that they're typically used across two or more separate
  processes.
- Specify that portable applications cannot use multiple readers or
  multiple writers for messages larger than a byte, due to potential
  interleaving.
- Remove no-longer-referenced footnote URLs.
2025-01-25 22:15:54 +02:00
Matthias Krüger
7a79024ef4
Rollup merge of #135991 - no1wudi:master, r=thomcc
Fix set_name in thread mod for NuttX

Replace `pthread_set_name_np` with `pthread_setname_np` for NuttX in the `set_name` function, this change aligns the implementation with the correct API available on NuttX

This patch ensures thread naming works correctly on NuttX platforms.

See also:
0f9f8c91ad/src/unix/nuttx/mod.rs (L562)
8f3a2a6f76/include/pthread.h (L511-L514)
2025-01-25 08:03:35 +01:00
Matthias Krüger
0741cc0ea7
Rollup merge of #135415 - Harshit933:hard-link-error, r=ChrisDenton
Add `File already exists` error doc to `hard_link` function

## Description
If the link path already exists, the error `AlreadyExists` is returned. This commit adds this error to the docs.

I tested it with the current rust master version, this error was returned when there is already a link for the file is present.
This was the error returned:
```
[harshit:../Desktop/rust_compiler_testing/hard_link (master|…5)] cargo +stage1 run
   Compiling hard_link v0.1.0 (/home/harshit/Desktop/rust_compiler_testing/hard_link)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.12s
     Running `target/debug/hard_link`
Err(Os { code: 17, kind: AlreadyExists, message: "File exists" })
```
This is my first PR on rust, any suggestions on which issue I can take next are most welcome 😄

Fixes #130117
2025-01-24 23:25:41 +01:00
Harshit Verma
ab274630b9 Add File already exists error doc to hard_link function
If the link path already exists, the error `AlreadyExists`
is returned. This commit adds this error to the docs.
2025-01-24 22:43:33 +05:30
Huang Qi
e170c9dec0 Fix set_name in thread mod for NuttX
Replace `pthread_set_name_np` with `pthread_setname_np` for NuttX in the `set_name` function,
this change aligns the implementation with the correct API available on NuttX

This patch ensures thread naming works correctly on NuttX platforms.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-01-24 21:21:30 +08:00
AkhilTThomas
3f045c9d2e add nto80 x86-64 and aarch64 target
Signed-off-by: Florian Bartels <Florian.Bartels@elektrobit.com>
2025-01-24 12:41:49 +00:00
Florian Bartels
efe53ddd58 Add support for QNX 7.1 with io-sock on x64
Signed-off-by: Florian Bartels <Florian.Bartels@elektrobit.com>
2025-01-24 12:32:20 +00:00
Florian Bartels
84c80151cf Add new target for supporting Neutrino QNX 6.1 with io-socket network stack on aarch64
Signed-off-by: Florian Bartels <Florian.Bartels@elektrobit.com>
2025-01-24 12:32:07 +00:00
bjorn3
a20996c180 Update a bunch of comments from before wasi support was added 2025-01-24 09:25:34 +00:00
bjorn3
88ff147c56 Remove a bunch of emscripten test ignores
They are either outdated as emscripten now supports i128 or they are
subsumed by #[cfg_attr(not(panic = "unwind"), ignore]
2025-01-24 09:25:34 +00:00
bjorn3
d0a70d9328 Fix testing of the standard library with Emscripten
This does need EMCC_CFLAGS="-s MAXIMUM_MEMORY=2GB" avoid several OOMs.
2025-01-24 09:25:34 +00:00
Matthias Krüger
08d5b2303a
Rollup merge of #135073 - joshtriplett:bstr, r=BurntSushi
Implement `ByteStr` and `ByteString` types

Approved ACP: https://github.com/rust-lang/libs-team/issues/502
Tracking issue: https://github.com/rust-lang/rust/issues/134915

These types represent human-readable strings that are conventionally,
but not always, UTF-8. The `Debug` impl prints non-UTF-8 bytes using
escape sequences, and the `Display` impl uses the Unicode replacement
character.

This is a minimal implementation of these types and associated trait
impls. It does not add any helper methods to other types such as `[u8]`
or `Vec<u8>`.

I've omitted a few implementations of `AsRef`, `AsMut`, and `Borrow`,
when those would be the second implementation for a type (counting the
`T` impl), to avoid potential inference failures. We can attempt to add
more impls later in standalone commits, and run them through crater.

In addition to the `bstr` feature, I've added a `bstr_internals` feature
for APIs provided by `core` for use by `alloc` but not currently
intended for stabilization.

This API and its implementation are based *heavily* on the `bstr` crate
by Andrew Gallant (`@BurntSushi).`

r? `@BurntSushi`
2025-01-23 19:54:23 +01:00
Matthias Krüger
3962bfaeed
Rollup merge of #135856 - fmease:library-mv-obj-save-dyn-compat-ii, r=tgross35
Library: Finalize dyn compatibility renaming

Update the Reference link to use the new URL fragment from https://github.com/rust-lang/reference/pull/1666 (this change has finally hit stable). Fixes a FIXME.

Follow-up to #130827.
Part of #130852.
2025-01-22 20:37:28 +01:00
Matthias Krüger
0bdc1015cc
Rollup merge of #135837 - ChrisDenton:trunc, r=Noratrieb
Remove test panic from File::open

Fixes #135831
2025-01-22 20:37:27 +01:00
León Orell Valerian Liehr
9e98d25729
Library: Finalize dyn compatibility renaming 2025-01-22 04:46:55 +01:00
Chris Denton
fed5f98c47
Remove test panic from File::open 2025-01-21 17:31:17 +00:00
Marijn Schouten
fdc80af5c5
fix OsString::from_encoded_bytes_unchecked description 2025-01-21 14:36:18 +01:00
bors
b605c65b6e Auto merge of #135224 - wyfo:tls-panic-outline, r=cuviper
Outline panicking code for `LocalKey::with`

See https://github.com/rust-lang/rust/pull/115491 for prior related modifications.

https://godbolt.org/z/MTsz87jGj shows a reduction of the code size for TLS accesses.
2025-01-21 02:23:15 +00:00
许杰友 Jieyou Xu (Joe)
e7f53663de
Rollup merge of #135626 - clubby789:env-note, r=ibraheemdev
doc: Point to methods on `Command` as alternatives to `set/remove_var`

Make these methods more discoverable, as configuring a child process is a common reason for manipulating the environment.
2025-01-20 21:45:04 +08:00
许杰友 Jieyou Xu (Joe)
e1e26f339d
Rollup merge of #135491 - RalfJung:remove-dead-rustc_allowed_through_unstable_modules, r=Mark-Simulacrum
Remove dead rustc_allowed_through_unstable_modules for std::os::fd contents

As far as I was able to reconstruct, the history here is roughly as follows:
- https://github.com/rust-lang/rust/pull/99723 added some `rustc_allowed_through_unstable_modules` to the types in `std::os::fd::raw` since they were accessible on stable via the unstable `std::os::wasi::io::AsRawFd` path. (This was needed to fix https://github.com/rust-lang/rust/issues/99502.)
- Shortly thereafter, https://github.com/rust-lang/rust/pull/98368 re-organized things so that instead of re-exporting from an internal  `std::os::wasi::io::raw`,   `std::os::wasi::io::AsRawFd` is now directly re-exported from `std::os::fd`. This also made `library/std/src/os/wasi/io/raw.rs` entirely dead code as far as I can tell, it's not imported by anything any more.
- Shortly thereafter, https://github.com/rust-lang/rust/pull/103308 stabilizes `std::os::wasi::io`, so `rustc_allowed_through_unstable_modules` is not needed any more to access `std::os::wasi::io::AsRawFd`. There is even a comment in `library/std/src/os/wasi/io/raw.rs` saying the attribute can be removed now, but that file is dead code so it is not touched as part of the stabilization.

I did a grep for `pub use crate::os::fd` and all the re-exports I could find are in stable modules. So given all that, we can remove the  `rustc_allowed_through_unstable_modules` (hoping they are not also re-exported somewhere else, it's really hard to be sure about this).

I have checked that std still builds after this PR on the wasm32-wasip2 target.
2025-01-20 12:38:32 +08:00
许杰友 Jieyou Xu (Joe)
e5b85035fe
Rollup merge of #135446 - klensy:panic_immediate_abort_ext, r=Mark-Simulacrum
further improve panic_immediate_abort by removing rtprintpanic! messages

Reduces binary size using `panic_immediate_abort` by removing strings used by `rtprintpanic!`.

for `main.rs`
```rust
fn main() {
    println!("Hello, world!");
}
```
with `Cargo.toml`
```toml
[package]
name = "tst"
version = "0.1.0"
edition = "2024"

[dependencies]

[profile.release]
lto = true
codegen-units = 1
panic = "abort"

```

and build with `RUSTFLAGS="-Zlocation-detail=none -Zfmt-debug=none" cargo +stage-1 b -r -Z build-std=std,panic_abort -Z build-std-features=optimize_for_size,panic_immediate_abort` for `x86_64-unknown-linux-gnu`

This reduces size:
| before |  after | type |
| - | - | - |
| 25256 | 21880 | unstripped |
| 18072 | 15288 | stripped |
2025-01-20 12:38:32 +08:00
Matthias Krüger
23fb4f22b3
Rollup merge of #135661 - tgross35:stabilize-float_next_up_down, r=scottmcm
Stabilize `float_next_up_down`

FCP completed at [1].

For `f16` and `f128`, this just removes the gates in comments and doctests.

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

[1]: https://github.com/rust-lang/rust/issues/91399#issuecomment-2598734570
2025-01-18 13:58:06 +01:00
Matthias Krüger
508c72b81e
Rollup merge of #135583 - NobodyXu:move-pipe-to-io, r=joshtriplett
Move `std::pipe::*` into `std::io`

Resolve concern from final comment period https://github.com/rust-lang/rust/issues/127154#issuecomment-2590419895
2025-01-18 13:58:03 +01:00
Trevor Gross
366cecacdd Stabilize float_next_up_down
FCP completed at [1].

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

[1]: https://github.com/rust-lang/rust/issues/91399#issuecomment-2598734570
2025-01-17 23:01:10 +00:00
Jiahao XU
81d70f92ab
Fix import of pipe in kernel_copy.rs
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2025-01-18 00:44:44 +11:00