Rollup of 11 pull requests - #160112
Open
jhpratt wants to merge 31 commits into
Open
Conversation
This makes the `dangling_pointers_from_temporaries` lint work with it.
I verified that this doesn't pessimize codegen using the example from the
PR that inroduced the optimization of `next_chunk` (# 149131):
```rust
#![feature(iter_next_chunk)]
#[no_mangle]
pub fn simd_sum_slow(arr: &[u32]) -> u32 {
const STEP_SIZE: usize = 16;
let mut result = [0; STEP_SIZE];
let mut iter = arr.iter();
while let Ok(c) = iter.next_chunk::<STEP_SIZE>() {
for (&n, r) in c.iter().zip(result.iter_mut()) {
*r += n;
}
}
result.iter().sum()
}
```
I compiled this example with
```shell
./build/host/stage1/bin/rustc t.rs --emit=asm -O --crate-type=lib
```
Before and after this change; the only difference is the choice of the
jump instruction, which I think shouldn't make any difference:
```diff
28,29c28,29
< cmpq $64, %rsi
< jae .LBB0_2
---
> cmpq $60, %rsi
> ja .LBB0_2
```
…pported (windows, unix, uefi, etc.); modified the Unix implementation to use fchmodat instead of open + fchmod; clarified documentations for set_permissions_nofollow; added a test case for set_permissions_nofollow
When a type param `T` is not `Sized` (i.e. `is_sized` returns false), removing an explicit `T: 'r` bound can silently change trait object lifetime defaults per RFC 599 — `Struct<dyn Trait>` would shift from `dyn Trait + 'r` to `dyn Trait + 'static`. Suppress the lint in that case using `Ty::new_param(...).is_sized(tcx, typing_env)`. Fixes rust-lang#134902
…rde formats Using `#[serde(flatten)]` and `#[serde(tag = "` break using rustdoc-json-types with serde serializers like postcard. rustdoc-json-types should work with these, even if rustdoc itself doesn't use this yet. This is a breaking change to the `FORMAT_VERSION` even though rust reader/writer code is uneffected.
Broaden `is_macos_ld` to `is_macos_linker` by matching `Darwin(..)` instead of `Darwin(_, Lld::No)`, so the linker output filtering also runs when lld is used. Add lld-specific version mismatch pattern to `deployment_mismatch` closure, routing these warnings to `linker_info` (default Allow) instead of `linker_messages` (default Warn). Add a real-lld sub-test to `macos-deployment-target-warning` that exercises the `ld64.lld` path via `-fuse-ld=`, verifying lld warnings are normalized and routed to `linker_info`. Signed-off-by: Ian Miller <milleryan2003@gmail.com>
It currently contains a `MaybeBorrowedLocals` cursor. The cursor is within a `RefCell` because cursor traversal requires mutation. The cursor is used in the `MaybeRequiresStorage::check_for_move` operation. Instead of using this cursor within `MaybeRequiresStorage` it's possible to do a pre-traversal of `MaybeBorrowedLocals` to extract the necessary information and then give that (immutably) to `MaybeRequiresStorage`. This commit makes that change. The extracted information is in the new `KillableLocals` type, which is computed by the `KillableLocalsVisitor` type within `MaybeRequiresStorage::new`. `MaybeRequiresStorage` no longer needs lifetimes. `MoveVisitor` is no longer needed. And the complicated `locals_live_across_suspend_points` gets a little simpler.
…licit_outlives_requirements`
…nofollow, r=clarfonthey Added implementation on `set_permissions_nofollow` for all primary platforms For context, this PR is related to the tracking issue for [`std::fs::set_permissions_nofollow`](rust-lang#141607). This PR does a few different things: * Windows support is provided for `std::fs::set_permissions_nofollow`. On Windows, it uses `OpenOptions::open` with the custom flag `FILE_FLAG_OPEN_REPARSE_POINT` enabled and then sets the permissions on the reparse point directly. All other platforms (hermit, motor, solid, uefi, etc.) defer to what `fs::set_permissions` does since symlinks aren't supported on those platforms, so they effectively do the same thing. * The implementation for Unix was modified to use [`fchmodat`](https://linux.die.net/man/2/fchmodat) instead of doing two separate calls (`open` and then `fchmod` via `OpenOptions`). * Because the previous implementations actually used `fchmod` instead of `chmod` underneath the hood (as that's what `File::set_permissions`, which is not to be confused with `fs::set_permissions` as that does use `chmod`, does underneath the hood), it actually had some incorrect documentation about the error returned by `fchmod` on symlinks. Instead of `io::ErrorKind::FilesystemLoop`, it returns `io::ErrorKind::InvalidInput`. You can read the documentation for [`fchmod`](https://pubs.opengroup.org/onlinepubs/009696699/functions/fchmod.html). `fchmodat` does effectively the same thing as the `open` + `fchmod` combo, but it does return a different error, `io::ErrorKind::Unsupported`, that makes more sense. Regardless, I corrected the documentation for `std::fs::set_permissions_nofollow` and added a lot more clarifying information. * A test case has been added to verify if `set_permissions_nofollow` is operating correctly. cc @ChrisDenton and @lolbinarycat
…Storage, r=cjgillot Simplify `MaybeRequiresStorage` It currently contains a `MaybeBorrowedLocals` cursor. The cursor is within a `RefCell` because cursor traversal requires mutation. The cursor is used in the `MaybeRequiresStorage::check_for_move` operation. Instead of using this cursor within `MaybeRequiresStorage` it's possible to do a pre-traversal of `MaybeBorrowedLocals` to extract the necessary information and then give that (immutably) to `MaybeRequiresStorage`. This commit makes that change. The extracted information is in the new `KillableLocals` type, which is computed by the `KillableLocalsVisitor` type within `MaybeRequiresStorage::new`. `MaybeRequiresStorage` no longer needs lifetimes. `MoveVisitor` is no longer needed. And the complicated `locals_live_across_suspend_points` gets a little simpler. r? @cjgillot
…r=nia-e Partially stabilize `box_vec_non_null` Closes rust-lang#130364 r? libs-api ### What's being stabilized The following is being stabilized in this PR: ```rust impl<T: ?Sized> Box<T> { pub unsafe fn from_non_null(ptr: NonNull<T>) -> Self { .... } pub fn into_non_null(b: Self) -> NonNull<T> { .... } } impl<T> Vec<T> { pub const unsafe fn from_parts(ptr: NonNull<T>, length: usize, capacity: usize) -> Self { .... } pub const fn into_parts(self) -> (NonNull<T>, usize, usize) { .... } } ``` Note that `Vec::from_parts` and `Vec::into_parts` remain const-unstable behind the `const_heap` feature (like `Vec::from_raw_parts` and `Vec::into_raw_parts`). The following APIs remain gated behind `allocator_api` ```rust impl<T: ?Sized, A: Allocator> Box<T, A> { pub unsafe fn from_non_null_in(raw: NonNull<T>, alloc: A) -> Self { .... } pub fn into_non_null_with_allocator(b: Self) -> (NonNull<T>, A) { .... } } impl<T, A: Allocator> Vec<T, A> { pub const unsafe fn from_parts_in(ptr: NonNull<T>, length: usize, capacity: usize, alloc: A) -> Self { .... } pub const fn into_parts_with_alloc(self) -> (NonNull<T>, usize, usize, A) { .... } } ``` The following API is split into a new unstable feature in rust-lang#157843, and remains unstable: ```rust impl<T, A: Allocator> Vec<T, A> { pub const fn as_non_null(&mut self) -> NonNull<T> { .... } } ``` ### Implementation History Most of this feature was ACP'ed in rust-lang/libs-team#418, and implemented in rust-lang#130061. `Vec::as_non_null` was ACP'ed separately in rust-lang/libs-team#440, and implemented in rust-lang#130624. ### Potential issues * Should `Vec::from_parts` and `Vec::into_parts` be the name used for this? Or should those names be used for functions that take/return `Box<[MaybeUninit<T>]>`? (Raised at rust-lang#130364 (comment)) * Should these function names be named `non_null` or `nonnull`? (Raised at rust-lang#130364 (comment). See rust-lang#154237 (comment).) * Will the methods on `Vec` collide with anything via autoderef?
…_simp, r=JohnTitor simplify `slice::Iter[Mut]::next_chunk` implementation I verified that this doesn't pessimize codegen using the example from the PR that inroduced the optimization of `next_chunk` (rust-lang#149131): ```rust #![feature(iter_next_chunk)] #[no_mangle] pub fn simd_sum_slow(arr: &[u32]) -> u32 { const STEP_SIZE: usize = 16; let mut result = [0; STEP_SIZE]; let mut iter = arr.iter(); while let Ok(c) = iter.next_chunk::<STEP_SIZE>() { for (&n, r) in c.iter().zip(result.iter_mut()) { *r += n; } } result.iter().sum() } ``` I compiled this example with ```shell ./build/host/stage1/bin/rustc t.rs --emit=asm -O --crate-type=lib ``` Before and after this change; the only difference is the choice of the jump instruction, which I think shouldn't make any difference: ```diff 28,29c28,29 < cmpq $64, %rsi < jae .LBB0_2 --- > cmpq $60, %rsi > ja .LBB0_2 ``` r? libs cc @bend-n
Enable `#[diagnostic::on_unknown]` during late res The pr prior to this is rust-lang#157926. That PR enabled it for early res, this PR does so for late res. r? @estebank
…tons, r=notriddle Fix rustdoc toolbar height when title is taller than one line Fixes rust-lang#160086. With the fix: <img width="814" height="238" alt="image" src="https://github.com/user-attachments/assets/5a8edb52-bc6e-44e7-943c-85a73f21e81e" /> r? @notriddle
…unsized, r=fmease fix: don't fire `explicit_outlives_requirements` on `?Sized` type params `explicit_outlives_requirements` uses `tcx.inferred_outlives_of()` to check whether an explicit `T: 'a` bound is structurally implied by struct fields. for a field `r: &'a T`, it is — so the lint fired and suggested removing it. but RFC 599 object lifetime defaults are computed from *explicit* HIR bounds not inferred ones. removing an explicit `T: 'a` from a `?Sized` type param silently changes every `Struct<dyn Trait>` use from `dyn Trait + 'a` to `dyn Trait + 'static`, breaking callers without any error. added a guard: before emitting the lint for a type param outlives bound, check whether the param carries any `?Sized` bound (`BoundPolarity::Maybe` in HIR). if so, skip — the bound may be the sole anchor for the object lifetime default. also suppresses the pre-existing false positive in `edition-lint-infer-outlives.rs` (noted in issue rust-lang#105150) which was an instance of the same bug. closes rust-lang#134902
…rr-warnings, r=petrochenkov fix(ld64.lld): route version mismatch warnings to linker_info on macOS r? jyn514 Fixes rust-lang#159227 **Issue:** .o objects (e.g. precompiled stdlib .rlib files, C libraries compiled via cc-rs) receive MacOS version of the machine they were compiled on and that version is much higher than Rust's default deployment target for aarch64-apple-darwin which is macOS 11.0.0. [`(Os::MacOs, crate::spec::Arch::AArch64, _) => (11, 0, 0)`](https://github.com/rust-lang/rust/blob/f65b272fc92b1e7527dea4a224430a249ab25c2d/compiler/rustc_target/src/spec/base/apple/mod.rs#L332) That’s why hundreds of warning logs appear such as warning: `linker stderr: rust-lld: /path/file.rlib(file.o) has version 26.4.1, which is newer than target minimum of 11.0.0`. These warnings were already filtered for ld64 and ld_prime but not for lld (see rust-lang#136113). **Root cause:** I believe that the current function `is_macos_ld()` in [compiler/rustc_codegen_ssa/src/back/link.rs](https://github.com/rust-lang/rust/blob/730a6b5dce9477b819de0ba79d6e7945e1248e3d/compiler/rustc_codegen_ssa/src/back/link.rs#L874) handles the case when we use native macOS linker so the entire filtering chain in linker output is skipped when using ld64.lld. Relevant code: ``` fn is_macos_ld(sess: &Session) -> bool { let (_, flavor) = linker_and_flavor(sess); sess.target.is_like_darwin && matches!(flavor, LinkerFlavor::Darwin(_, Lld::No)) } ``` So, `Lld::No` means using native macOS linker, so when lld is used via `Lld::Yes`, the match fails and the function returns `false` hence all warnings come from stderr to linker_messages which are visible. **My proposed solution:** modify filtering such that it runs for lld too and add a new specific ld64.lld warning pattern routing warnings to linker_info to make them invisible by default.
…=GuillaumeGomez rustdoc-json: Make `Stability` compatible with non-self-describing serde formats Using `#[serde(flatten)]` and `#[serde(tag = "` break using rustdoc-json-types with serde serializers like postcard. rustdoc-json-types should work with these, even if rustdoc itself doesn't use this yet. This is a breaking change to the `FORMAT_VERSION` even though rust reader/writer code is uneffected. cc @obi1kenobi r? @GuillaumeGomez
…unconstrained-test, r=JohnTitor Add regression test for enum unconstrained parameter Fixes rust-lang#159811 It's fixed by rust-lang#157846
…olkertdev Use assert_eq! in splat codegen tests Tracking issue: rust-lang#153629 This PR does some cleanups in the splat UI tests from folkert's PR rust-lang#159643 review: - move rustfmt::skip to main() and deduplicate it: rust-lang#159643 (comment) - use assert_eq!() to test codegen rather than println!(): rust-lang#159643 (comment) - delete resolved FIXME comments about supporting tupled and de-tupled calls to splatted functions r? @folkertdev @rustbot label +F-splat +C-cleanup
Member
Author
|
@bors r+ rollup=never p=5 |
Contributor
This comment has been minimized.
This comment has been minimized.
rust-bors Bot
pushed a commit
that referenced
this pull request
Jul 29, 2026
Rollup of 11 pull requests Successful merges: - #158168 (Added implementation on `set_permissions_nofollow` for all primary platforms) - #160055 (Simplify `MaybeRequiresStorage`) - #157226 (Partially stabilize `box_vec_non_null`) - #158879 (simplify `slice::Iter[Mut]::next_chunk` implementation) - #159413 (Enable `#[diagnostic::on_unknown]` during late res) - #160091 (Fix rustdoc toolbar height when title is taller than one line) - #158615 (fix: don't fire `explicit_outlives_requirements` on `?Sized` type params) - #159666 (fix(ld64.lld): route version mismatch warnings to linker_info on macOS) - #160032 (rustdoc-json: Make `Stability` compatible with non-self-describing serde formats) - #160039 (Add regression test for enum unconstrained parameter ) - #160049 (Use assert_eq! in splat codegen tests)
Collaborator
|
The job Click to see the possible cause of the failure (guessed by this bot) |
Contributor
|
💔 Test for c5f1c73 failed: CI. Failed job:
|
Member
Author
Contributor
|
⌛ Trying commit 4a7ab6f with merge 20cd981… To cancel the try build, run the command Workflow: https://github.com/rust-lang/rust/actions/runs/30422097715 |
rust-bors Bot
pushed a commit
that referenced
this pull request
Jul 29, 2026
Rollup of 11 pull requests try-job: dist-various-1 try-job: test-various try-job: x86_64-gnu-aux try-job: x86_64-gnu-llvm-21-3 try-job: x86_64-msvc-1 try-job: aarch64-apple try-job: x86_64-mingw-1 try-job: i686-msvc-*
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Successful merges:
set_permissions_nofollowfor all primary platforms #158168 (Added implementation onset_permissions_nofollowfor all primary platforms)MaybeRequiresStorage#160055 (SimplifyMaybeRequiresStorage)box_vec_non_null#157226 (Partially stabilizebox_vec_non_null)slice::Iter[Mut]::next_chunkimplementation #158879 (simplifyslice::Iter[Mut]::next_chunkimplementation)#[diagnostic::on_unknown]during late res #159413 (Enable#[diagnostic::on_unknown]during late res)explicit_outlives_requirementson?Sizedtype params #158615 (fix: don't fireexplicit_outlives_requirementson?Sizedtype params)Stabilitycompatible with non-self-describing serde formats #160032 (rustdoc-json: MakeStabilitycompatible with non-self-describing serde formats)r? @ghost
Create a similar rollup