Rollup of 11 pull requests - #160112
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
|
@bors r+ rollup=never p=5 |
This comment has been minimized.
This comment has been minimized.
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)
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
💔 Test for c5f1c73 failed: CI. Failed job:
|
This comment has been minimized.
This comment has been minimized.
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 comment has been minimized.
This comment has been minimized.
|
📌 Perf builds for each rolled up PR:
previous master: 701a6513a4 In the case of a perf regression, run the following command for each PR you suspect might be the cause: |
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing 701a651 (parent) -> ce69831 (this PR) Test differencesShow 1063 test diffsStage 0
Stage 1
Stage 2
Additionally, 1046 doctest diffs were found. These are ignored, as they are noisy. Job group index
Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard ce6983167791bf9418726264f8e5cc7abf73d69b --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (ce69831): comparison URL. Overall result: ❌✅ regressions and improvements - no action needed@rustbot label: -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (secondary -5.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary 1.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 491.747s -> 490.002s (-0.35%) |
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