Skip to content

Rollup of 6 pull requests#157167

Closed
jhpratt wants to merge 13 commits into
rust-lang:mainfrom
jhpratt:rollup-5N5IQAF
Closed

Rollup of 6 pull requests#157167
jhpratt wants to merge 13 commits into
rust-lang:mainfrom
jhpratt:rollup-5N5IQAF

Conversation

@jhpratt
Copy link
Copy Markdown
Member

@jhpratt jhpratt commented May 30, 2026

Successful merges:

r? @ghost

Create a similar rollup

devnexen and others added 13 commits April 26, 2026 14:51
map io::Stdout/Stderr to Stdio::Inherit and File to a new InheritFile
variant returning io::Error from output() instead of aborting.
The `fuzzy_provenance_casts` lint is enabled in most of the standard
library, but its identical twin `lossy_provenance_casts` was not. As
discussed in the tracking issue for those lints, there doesn't seem to
be any good reason to enable one without the other. This PR applies this
principle and as a result removes some unnecessary ptr->int `as` casts.

It's also preparation for merging the two lints, which removes the
option of only enabling `fuzzy_provenance_casts`.
The `#[rustc_on_unimplemented]` note on `Debug` ("add `#[derive(Debug)]`
to `X` or manually `impl Debug for X`") duplicates the `consider
annotating X with #[derive(..)]` suggestion emitted by `suggest_derive`.

Skip the note when that suggestion will be shown, and keep it otherwise
so types whose derive can't be suggested (e.g. a field isn't `Debug`)
still get actionable guidance.
The condition is loop-invariant, so iterating the notes only to skip
every one wastes work. Test the derive suggestion once and skip the
whole loop when it will be shown.
…venance-lints, r=jhpratt

library: use strict provenance lints consistently

The `fuzzy_provenance_casts` lint is enabled in most of the standard library, but its identical twin `lossy_provenance_casts` was not. As discussed in the tracking issue for those lints, there doesn't seem to be any good reason to enable one without the other. This PR applies this principle and as a result removes some unnecessary ptr->int `as` casts.

It's also preparation for merging the two lints, which removes the option of only enabling `fuzzy_provenance_casts`.

Tracking issue: rust-lang#130351
net tests: let the OS pick the port numbers

This finishes what I started in rust-lang#156385.
Fixes rust-lang#156377.
…-note-on-unimplemented, r=estebank

Avoid redundant note when a #[derive] is already suggested

Fixes rust-lang#157118

The `Debug` `#[rustc_on_unimplemented]` note ("add `#[derive(Debug)]` to `X` or manually `impl Debug for X`") just repeats the `consider annotating X with #[derive(..)]` suggestion that `suggest_derive` already emits, so on these bound errors it's pure noise.

Now the note only gets dropped when that suggestion will actually show, which is whenever `can_suggest_derive` holds: a crate-local ADT, not a union, with every field already implementing the trait. Deleting the note from the attribute outright would be too blunt, since when `can_suggest_derive` is false there's no suggestion and the note is the only hint the user gets. A crate-local struct with a non-`Debug` field still ends up with just:

```
error[E0277]: `Outer` doesn't implement `Debug`
   = note: add `#[derive(Debug)]` to `Outer` or manually `impl Debug for Outer`
```

Same story when `main_trait_predicate != leaf_trait_predicate`, since the note comes from the main predicate and the suggestion from the leaf.
std::process: uefi: avoid panicking in Stdio From impls.

map io::Stdout/Stderr to Stdio::Inherit and File to a new InheritFile variant returning io::Error from output() instead of aborting.
…nts, r=jhpratt

Migrate libraries from ptr::slice_from_raw_parts to .cast_slice

Tracking issue for `#![feature(ptr_cast_slice)]`: rust-lang#149103
This commit updates most callsites of ptr::slice_from_raw_parts within ./library to the more concise but unstable postfix `.cast_slice()` method on raw pointers, using the `ptr_cast_slice` feature. Some tests in alloctests have also been updated.

No functional change, debatably improved readability.
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label May 30, 2026
@rustbot rustbot added O-SGX Target: SGX S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels May 30, 2026
@jhpratt
Copy link
Copy Markdown
Member Author

jhpratt commented May 30, 2026

@bors r+ rollup=never p=5

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 30, 2026

📌 Commit 6e38224 has been approved by jhpratt

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 30, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request May 30, 2026
Rollup of 6 pull requests

Successful merges:

 - #156832 (library: use strict provenance lints consistently)
 - #157006 (net tests: let the OS pick the port numbers)
 - #157126 (Avoid redundant note when a #[derive] is already suggested)
 - #151690 (std: Refactor `env::var` function)
 - #155826 (std::process: uefi: avoid panicking in Stdio From impls.)
 - #156109 (Migrate libraries from ptr::slice_from_raw_parts to .cast_slice)
@rust-log-analyzer
Copy link
Copy Markdown
Collaborator

The job dist-ohos-armv7 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[RUSTC-TIMING] object test:false 5.189
error: under strict provenance it is considered bad style to cast pointer `*mut libc::c_void` to integer `u32`
   --> /rustc/535179da9caa88b0ddd0f3426e5a242fcb932f07/library/std/src/os/unix/thread.rs:35:9
    |
 35 |         self.as_inner().id() as RawPthread
    |         ^^^^^^^^^^^^^^^^^^^^--------------
    |                             |
    |                             help: use `.addr()` to obtain the address of a pointer: `.addr() as u32`
    |
    = help: if you can't comply with strict provenance and need to expose the pointer provenance you can use `.expose_provenance()` instead
note: the lint level is defined here
   --> /rustc/535179da9caa88b0ddd0f3426e5a242fcb932f07/library/std/src/lib.rs:249:9
    |
249 | #![deny(lossy_provenance_casts)]
    |         ^^^^^^^^^^^^^^^^^^^^^^

error: under strict provenance it is considered bad style to cast pointer `*mut libc::c_void` to integer `u32`
  --> /rustc/535179da9caa88b0ddd0f3426e5a242fcb932f07/library/std/src/os/unix/thread.rs:39:9
   |
39 |         self.into_inner().into_id() as RawPthread
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^--------------
   |                                    |
   |                                    help: use `.addr()` to obtain the address of a pointer: `.addr() as u32`
   |
   = help: if you can't comply with strict provenance and need to expose the pointer provenance you can use `.expose_provenance()` instead

[RUSTC-TIMING] std test:false 3.514
error: could not compile `std` (lib) due to 2 previous errors

@rust-bors rust-bors Bot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 30, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 30, 2026

💔 Test for 535179d failed: CI. Failed job:

@rust-bors rust-bors Bot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label May 30, 2026
@rust-bors rust-bors Bot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 30, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 30, 2026

PR #156832, which is a member of this rollup, was unapproved.

@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label May 30, 2026
@jhpratt jhpratt deleted the rollup-5N5IQAF branch May 30, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

O-SGX Target: SGX rollup A PR which is a rollup T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants