Skip to content

Update subtree/library to 2025-04-19 #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 131 commits into
base: subtree/library
Choose a base branch
from

Conversation

github-actions[bot]
Copy link

This is an automated PR to update the subtree/library branch to the changes from 2025-04-04 (rust-lang/rust@00095b3) to 2025-04-19 (rust-lang/rust@191df20), inclusive.
Review this PR as usual, but do not merge this PR using the GitHub web interface. Instead, once it is approved, use git push to literally push the changes to subtree/library without any rebase or merge.

scottmcm and others added 30 commits March 1, 2025 13:06
This way it can use the nice new LLVM intrinsic in LLVM20.
Encodes the safety constraint that `Unique`'s pointer must be non-zero
into the API.
Removes some unsafety and reduces the number of `usize` -> `ptr`
transmutes which might be helpful for CHERI-like targets in the future.
The LLVM issue [1] was resolved and the fix was synced to rust-lang/rust
in [2].

This reverts commit c51b229.

[1]: llvm/llvm-project#129394
[2]: rust-lang#138695
Fix std build for all NuttX targets. It is the single largest set of
failures on <https://does-it-build.noratrieb.dev/>. Although, ESP-IDF
also requires these same gates, there are other issues for those
targets.

This can verified be running `x check library/std --target=` for all
NuttX targets.
- src\doc\nomicon\src\ffi.md should also have its ABI list updated
…oratrieb

Replace last `usize` -> `ptr` transmute in `alloc` with strict provenance API

This replaces the `usize -> ptr` transmute in `RawVecInner::new_in` with a strict provenance API (`NonNull::without_provenance`).

The API is changed to take an `Alignment` which encodes the non-null constraint needed for `Unique` and allows us to do the construction safely.

Two internal-only APIs were added to let us avoid UB-checking in this hot code: `Layout::alignment` to get the `Alignment` type directly rather than as a `usize`, and `Unique::from_non_null` to create `Unique` in const context without a transmute.
… r=oli-obk

 Remove support for `extern "rust-intrinsic"` blocks

Part of rust-lang#132735

Looked manageable and there didn't appear to have been progress in the last two weeks,
so decided to give it a try.
Use `const_eval_select!()` macro to enable contract checking only at
runtime. The existing contract logic relies on closures,
which are not supported in constant functions.

This commit also removes one level of indirection for ensures clauses,
however, it currently has a spurious warning message when the bottom
of the function is unreachable.
Passing a `Result<(), &dyn Any>` to `calc_result` requires awkward code at both
call sites, for no real benefit. It's much easier to just pass the payload as
`Option<&dyn Any>`.

No functional change, except that the owned payload is dropped slightly later.
Also checked the rest of the mentions of std::mem in the changed file
and they look good to me.
document panic behavior of Vec::resize and Vec::resize_with

This adds panic documentation to ´Vec::resize´ and ´Vec::resize_with´. Fixes rust-lang#117437.
Invert the order that we pass the arguments to the
`contract_check_ensures` function to avoid the warning when the tail
of the function is unreachable.

Note that the call itself is also unreachable, but we have already
handled that case by ignoring unreachable call for contract calls.
Fix deprecation note for std::intrinsics

Also checked the rest of the mentions of std::mem in the changed file and they look good to me.

Fixes rust-lang#139505
If possible, we should try not to use verbatim paths in Command::current_dir. It might work but it might also break code (including some Windows APIs) that assume the current directory isn't verbatim.
…iaskrgr

Rollup of 10 pull requests

Successful merges:

 - rust-lang#139494 (Restrict some queries by def-kind more)
 - rust-lang#139496 (Revert r-a changes of rust-lang#139455)
 - rust-lang#139506 (add missing word in doc comment (part 2))
 - rust-lang#139515 (Improve presentation of closure signature mismatch from `Fn` trait goal)
 - rust-lang#139520 (compiletest maintenance: sort deps and drop dep on `anyhow`)
 - rust-lang#139523 (Rustc dev guide subtree update)
 - rust-lang#139526 (Fix deprecation note for std::intrinsics)
 - rust-lang#139528 (compiletest: Remove the `--logfile` flag)
 - rust-lang#139541 (Instantiate higher-ranked transmute goal w/ placeholders before emitting sub-obligations)
 - rust-lang#139547 (Update library tracking issue template to set S-tracking-unimplemented)

r? `@ghost`
`@rustbot` modify labels: rollup
RalfJung and others added 30 commits April 14, 2025 13:56
Report line number of test when should_panic test failed

Closes rust-lang#137405

---

try-job: x86_64-gnu-llvm-19-3
try-job: test-various
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#139127 (Fix up partial res of segment in primitive resolution hack)
 - rust-lang#139392 (Detect and provide suggestion for `&raw EXPR`)
 - rust-lang#139767 (Visit place in `BackwardIncompatibleDropHint` statement)
 - rust-lang#139777 (Remove `define_debug_via_print` for `ExistentialProjection`, use regular structural debug impl)
 - rust-lang#139796 (ptr docs: add missing backtics around 'usize')
 - rust-lang#139801 (Add myself to mailmap)
 - rust-lang#139804 (use `realpath` in `bootstrap.py` when creating build-dir)
 - rust-lang#139807 (Improve wording of post-merge report)

r? `@ghost`
`@rustbot` modify labels: rollup
This change maps the EOPNOTSUPP errno value (95) to std::io::ErrorKind::Unsupported in the decode_error_kind function for Unix platforms. Previously, it was incorrectly mapped to ErrorKind::Uncategorized.

Fixes rust-lang#139803
…, r=joboet

Avoid unused clones in `Cloned<I>` and `Copied<I>`

Avoid cloning in `Cloned<I>` or copying in `Copied<I>` when elements are only needed by reference or not at all. There is already some precedent for this, given that `__iterator_get_unchecked` is implemented, which can skip elements. The reduced clones are technically observable by a user impl of `Clone`.

r? libs-api
…ct, r=compiler-errors,oli-obk,RalfJung

Enable contracts for const functions

Use `const_eval_select!()` macro to enable contract checking only at runtime. The existing contract logic relies on closures, which are not supported in constant functions.

This commit also removes one level of indirection for ensures clauses since we no longer build a closure around the ensures predicate.

Resolves rust-lang#136925

**Call-out:** This is still a draft PR since CI is broken due to a new warning message for unreachable code when the bottom of the function is indeed unreachable. It's not clear to me why the warning wasn't triggered before.

r? ```@compiler-errors```
…oboet

std: sys: process: uefi: Use NULL stdin by default

According to the docs in `Command::output`:

> By default, stdout and stderr are captured (and used to provide the
resulting output). Stdin is not inherited from the parent and any attempt by the child process to read from the stdin stream will result in the stream immediately closing.

This was being violated by UEFI which was inheriting stdin by default.

While the docs don't explicitly state that the default should be NULL, the behaviour seems like reading from NULL.

UEFI however, has a bit of a problem. The `EFI_SIMPLE_TEXT_INPUT_PROTOCOL` only provides support for reading 1 key press. This means that you either get an error, or it is assumed that the keypress was read successfully. So there is no way to have a successful read of length 0. Currently, I am returning UNSUPPORTED error when trying to read from NULL stdin. On linux however, you will get a read of length 0 for Null stdin.

One possible way to get around this is to translate one of the UEFI errors to a read 0 (Maybe unsupported?). It is also possible to have a non-standard error code, but well, not sure if we go that route.

Alternatively, if meaning of Stdio::Null is platform dependent, it should be fine to keep the current behaviour of returning an error.

cc ```@nicholasbishop``` ```@dvdhrm```
…=tgross35

std: add Output::exit_ok

approved in ACP rust-lang/libs-team#554

Tracking issue: rust-lang#84908
Proc macro span API redesign: Replace proc_macro::SourceFile by Span::{file, local_file}

Simplification/redesign of the unstable proc macro span API, tracked in rust-lang#54725:

Before:

```rust
impl Span {
    pub fn line(&self) -> usize;
    pub fn column(&self) -> usize;
    pub fn source_file(&self) -> SourceFile;
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct SourceFile { .. }

impl !Send for SourceFile {}
impl !Sync for SourceFile {}

impl SourceFile {
    pub fn path(&self) -> PathBuf;
    pub fn is_real(&self) -> bool;
}
```

After:

```rust
impl Span {
    pub fn line(&self) -> usize;
    pub fn column(&self) -> usize;
    pub fn file(&self) -> String; // Mapped file name, for display purposes.
    pub fn local_file(&self) -> Option<PathBuf>; // Real file name as it exists on disk.
}
```

This resolves the last blocker for stabilizing these methods. (Stabilizing will be a separate PR with FCP.)
std/thread: Use default stack size from menuconfig for NuttX

* Update comments to clarify the usage of zero as an indication for default stack size configuration
* Adjust conditional compilation to reflect the changes in stack size handling for the NuttX platform

This change improves clarity and consistency in stack size configuration across platforms.
…tolnay

Fix: Map EOPNOTSUPP to ErrorKind::Unsupported on Unix

This change maps the EOPNOTSUPP errno value (95) to std::io::ErrorKind::Unsupported in the decode_error_kind function for Unix platforms. Previously, it was incorrectly mapped to ErrorKind::Uncategorized.

Fixes rust-lang#139803
Suggested-by: Tamir Duberstein <[email protected]>
Signed-off-by: Alice Ryhl <[email protected]>
Co-authored-by: Ralf Jung <[email protected]>
Rollup of 17 pull requests

Successful merges:

 - rust-lang#138374 (Enable contracts for const functions)
 - rust-lang#138380 (ci: add runners for vanilla LLVM 20)
 - rust-lang#138393 (Allow const patterns of matches to contain pattern types)
 - rust-lang#139517 (std: sys: process: uefi: Use NULL stdin by default)
 - rust-lang#139554 (std: add Output::exit_ok)
 - rust-lang#139660 (compiletest: Add an experimental new executor to replace libtest)
 - rust-lang#139669 (Overhaul `AssocItem`)
 - rust-lang#139671 (Proc macro span API redesign: Replace proc_macro::SourceFile by Span::{file, local_file})
 - rust-lang#139750 (std/thread: Use default stack size from menuconfig for NuttX)
 - rust-lang#139772 (Remove `hir::Map`)
 - rust-lang#139785 (Let CStrings be either 1 or 2 byte aligned.)
 - rust-lang#139789 (do not unnecessarily leak auto traits in item bounds)
 - rust-lang#139791 (drop global where-bounds before merging candidates)
 - rust-lang#139798 (normalize: prefer `ParamEnv` over `AliasBound` candidates)
 - rust-lang#139822 (Fix: Map EOPNOTSUPP to ErrorKind::Unsupported on Unix)
 - rust-lang#139833 (Fix some HIR pretty-printing problems)
 - rust-lang#139836 (Basic tests of MPMC receiver cloning)

r? `@ghost`
`@rustbot` modify labels: rollup
cfi: do not transmute function pointers in formatting code

Follow-up to rust-lang#115954.
Addresses rust-lang#115199 point 2.
Related to rust-lang#128728.
Discussion [on the LKML](https://lore.kernel.org/all/[email protected]/).

cc `@maurer` `@rcvalle` `@RalfJung`
The methods `Take::get_mut` and `Chain::get_mut` include comments
warning about modifying the I/O state of the underlying reader. However,
many readers (e.g. `File`) allow I/O using a shared reference (e.g.
`&File`). So, add the same caveat to the `get_ref` methods.
cfi: Remove #[no_sanitize(cfi)] for extern weak functions

Previously (rust-lang#115200, rust-lang#138002), we added `#[no_sanitize(cfi)]` to all code paths that call to a weakly linked function.

In rust-lang#138349 we fixed the root cause for this issue, which means we can now remove the corresponding attributes.

r? `@rcvalle`
This intrinsic doesn't drop the value that is not selected so this is
manually done in the public function that wraps the intrinsic.
Includes the following changes:

* Replace `#[naked]` with `#[unsafe(naked)]` [1] [2]
* Replace `bl!` with `asm_sym` [3]

[1]: rust-lang/compiler-builtins#817
[2]: rust-lang/compiler-builtins#821
[3]: rust-lang/compiler-builtins#820
f*::NAN: guarantee that this is a quiet NaN

I think we should guarantee that this is a quiet NaN. This then implies that programs not using `f*::from_bits` (or unsafe type conversions) are guaranteed to only work with quiet NaNs. It would be awkward if people start to write `0.0 / 0.0` instead of using the constant just because they want to get a guaranteed-quiet NaN.

This is a `@rust-lang/libs-api` change. The definition of this constant currently is `0.0 / 0.0`, which is already guaranteed to be a quiet NaN. So all this does is forward that guarantee to our users.
… r=RalfJung

Fix drop handling in `hint::select_unpredictable`

This intrinsic doesn't drop the value that is not selected so this is manually done in the public function that wraps the intrinsic.
…alfJung,tgross35

sync::mpsc: prevent double free on `Drop`

This PR is fixing a regression introduced by rust-lang#121646 that can lead to a double free when dropping the channel.

The details of the bug can be found in the corresponding crossbeam PR crossbeam-rs/crossbeam#1187
Update `compiler-builtins` to 0.1.155

Includes the following changes:

* Replace `#[naked]` with `#[unsafe(naked)]` [1] [2]
* Replace `bl!` with `asm_sym` [3]

[1]: rust-lang/compiler-builtins#817
[2]: rust-lang/compiler-builtins#821
[3]: rust-lang/compiler-builtins#820

try-job: armhf-gnu
try-job: aarch64-apple
try-job: dist-apple-various
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#138528 (deref patterns: implement implicit deref patterns)
 - rust-lang#139393 (rustdoc-json: Output target feature information)
 - rust-lang#139553 (sync::mpsc: prevent double free on `Drop`)
 - rust-lang#139615 (Remove `name_or_empty`)
 - rust-lang#139853 (Disable combining LLD with external llvm-config)
 - rust-lang#139913 (rustdoc/clean: Fix lowering of fn params (fixes correctness & HIR vs. middle parity regressions))
 - rust-lang#139942 (Ignore aix for tests/ui/erros/pic-linker.rs)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.