Skip to content

Rollup of 6 pull requests#158670

Closed
JonathanBrouwer wants to merge 19 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-CTONoYM
Closed

Rollup of 6 pull requests#158670
JonathanBrouwer wants to merge 19 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-CTONoYM

Conversation

@JonathanBrouwer

Copy link
Copy Markdown
Contributor

Successful merges:

r? @ghost

Create a similar rollup

vinDelphini and others added 19 commits June 13, 2026 15:18
Clarify that GuardBack initializes arrays from the end.

Restore performance note for iter_next_chunk_erased regarding optimization issues.
I copied the impl block from Guard without noticing that Destruct was only there for const contexts. Consumed the suggestion, thanks.

Co-authored-by: Chayim Refael Friedman <chayimfr@gmail.com>
…troduced next_chunk_back implementation in IntoIter, updated documentation, and added test cases for DoubleEndedIterator::next_chunk_back
The guard checked `data_len > u16::MAX`, allowing paths far larger than
`PathBuffer` (a fixed 16384-element array), which the subsequent single
`copy_from` then overflows. Bound against `MAXIMUM_REPARSE_DATA_BUFFER_SIZE`
plus header instead, matching the kernel's limit.
Add support for LoongArch LSX and LASX registers in inline assembly by
introducing the `vreg` and `xreg` register classes, along with their
associated vector types and operand modifiers. The new register classes
are gated behind the `asm_experimental_reg` feature. Also model the overlap
between FPU, LSX, and LASX registers so register conflict checking works
correctly for aliased registers.
Add UI tests for LoongArch LSX/LASX inline asm registers, including
target-feature gating and overlap diagnostics between `fN`, `vrN`, and
`xrN` registers.
Add assembly tests for LoongArch inline asm register modifiers. Verify
that the `w` and `u` modifiers correctly select LSX and LASX register
views for `freg`, `vreg`, and `xreg` operands and produce the expected
register names in the generated assembly.
Change HirId to its parent item LocalDefId.
…xt_chunk_back, r=aapoalas

Implement `DoubleEndedIterator::next_chunk_back`

This PR builds off on @vinDelphini's [PR](rust-lang#151668) on introducing `DoubleEndedIterator::next_chunk_back` (which will be used in a follow up PR to optimize `ArrayChunks::try_rfold` once merged). This was in the works since late Jan and I thought to pick it up and get this over the finish line as vinDelphini has been away from the PR for a couple of months. I've made sure to pull from vinDelphini's branch to keep him authored on the commits he made.

Other things introduced from this PR is specialization like done for `Iterator::next_chunk`, constifying some stuff, making a custom `DoubleEndedIterator::next_chunk_back` for `IntoIter` (since it also has a custom impl of `Iterator::next_chunk`), and a bunch of tests mirroring that of `Iterator::next_chunk`.

There's no tracking issue for this yet, but the ACP for this introduction is [here](rust-lang/libs-team#734). I'll create the tracking issue for this soon.

----

Actually, can we have `DoubleEndedIterator::next_chunk_back` underneath [`Iterator::next_chunk` tracking issue](rust-lang#98326)?
…arksonn

std: fix stack buffer overflow in Windows junction_point

The guard checked `data_len > u16::MAX`, allowing paths far larger than `PathBuffer` (a fixed 16384-element array), which the subsequent single `copy_from` then overflows. Bound against `MAXIMUM_REPARSE_DATA_BUFFER_SIZE` plus header instead, matching the kernel's limit.
std: use `OnceLock` for SGX environment variable storage

The SGX environment code predates the existence of `OnceLock` and `AtomicPtr` and consequently violates strict provenance. By using `OnceLock` we can remove all the `unsafe` code (except for the `unsafe` in the function signatures, that's required by other platforms).

CC @jethrogb @raoulstrackx @aditijannu
…d, r=aapoalas

Implement `ptr::{read,write}_unaligned` via `repr(packed)`

We already support doing unaligned reads & writes via `repr(packed)` fields, so this just uses that support from the backend rather than needing to thinks about `memcpy` and `intrinsics::forget` and such.

Turns out in codegen this ends up essentially identical because the packed type read gets `BackendRepr::Memory` and thus the read/write of the packed type *is* an `align 1` memcpy, just like the library code before this PR.  But doing this gives much simpler MIR and rust-lang#158291 will make it better than the previous version by not needing to emit the `memcpy` at all for things like `read_unaligned::<u32>`.

First commit are some tests that pass on master; Second commit changes the implementation and shows the corresponding test changes.

r? libs
…esleywiser

Change `adjust_ident_and_get_scope` arg to `LocalDefId`

Addresses a FIXME. Change a HirId to its owner LocalDefId.
rustc_target/asm: add LoongArch LSX/LASX inline asm register support

Add support for LoongArch LSX and LASX registers in inline assembly by introducing the `vreg` and `xreg` register classes, along with their associated vector types and operand modifiers. The new register classes are gated behind the `asm_experimental_reg` feature. Also model the overlap between FPU, LSX, and LASX registers so register conflict checking works correctly for aliased registers.
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label Jul 1, 2026
@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. 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 Jul 1, 2026
@JonathanBrouwer

Copy link
Copy Markdown
Contributor Author

@bors r+ rollup=never p=5

Trying commonly failed jobs
@bors try jobs=dist-various-1,test-various,x86_64-gnu-aux,x86_64-gnu-llvm-21-3,x86_64-msvc-1,aarch64-apple,x86_64-mingw-1,i686-msvc-2

@rust-bors

rust-bors Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

📌 Commit c3fe8ff has been approved by JonathanBrouwer

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 Jul 1, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 1, 2026
Rollup of 6 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-2
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 1, 2026
…uwer

Rollup of 6 pull requests

Successful merges:

 - #156737 (Implement `DoubleEndedIterator::next_chunk_back`)
 - #158147 (std: fix stack buffer overflow in Windows junction_point)
 - #158180 (std: use `OnceLock` for SGX environment variable storage)
 - #158427 (Implement `ptr::{read,write}_unaligned` via `repr(packed)`)
 - #158531 (Change `adjust_ident_and_get_scope` arg to `LocalDefId`)
 - #158364 (rustc_target/asm: add LoongArch LSX/LASX inline asm register support)
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job x86_64-msvc-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
failures:

---- fs::tests::create_dir_all_with_junctions stdout ----

thread 'fs::tests::create_dir_all_with_junctions' (1312) panicked at library\std\src\fs\tests.rs:1710:5:
junction_point(&target, &junction) failed with: The data present in the reparse point buffer is invalid. (os error 4392)
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: <<alloc::boxed::Box<dyn core::error::Error + core::marker::Sync + core::marker::Send> as core::convert::From<alloc::string::String>>::from::StringError as core::fmt::Debug>::fmt
   3: <rand_xorshift::XorShiftRng as rand_core::SeedableRng>::from_seed
   4: core::slice::sort::unstable::heapsort::heapsort::<usize, <usize as core::cmp::PartialOrd>::lt>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- fs::tests::create_dir_all_with_junctions stdout end ----
---- fs::tests::recursive_rmdir stdout ----

thread 'fs::tests::recursive_rmdir' (7644) panicked at library\std\src\fs\tests.rs:905:5:
junction_point(&d2, &dt.join("d2")) failed with: The data present in the reparse point buffer is invalid. (os error 4392)
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: <<alloc::boxed::Box<dyn core::error::Error + core::marker::Sync + core::marker::Send> as core::convert::From<alloc::string::String>>::from::StringError as core::fmt::Debug>::fmt
   3: <rand_xorshift::XorShiftRng as rand_core::SeedableRng>::from_seed
   4: core::slice::sort::unstable::heapsort::heapsort::<usize, <usize as core::cmp::PartialOrd>::lt>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- fs::tests::recursive_rmdir stdout end ----
---- fs::tests::recursive_rmdir_of_symlink stdout ----

thread 'fs::tests::recursive_rmdir_of_symlink' (1472) panicked at library\std\src\fs\tests.rs:926:5:
junction_point(&dir, &link) failed with: The data present in the reparse point buffer is invalid. (os error 4392)
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: <<alloc::boxed::Box<dyn core::error::Error + core::marker::Sync + core::marker::Send> as core::convert::From<alloc::string::String>>::from::StringError as core::fmt::Debug>::fmt
   3: <rand_xorshift::XorShiftRng as rand_core::SeedableRng>::from_seed
   4: core::slice::sort::unstable::heapsort::heapsort::<usize, <usize as core::cmp::PartialOrd>::lt>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- fs::tests::recursive_rmdir_of_symlink stdout end ----
---- fs::tests::test_rename_junction stdout ----

thread 'fs::tests::test_rename_junction' (3328) panicked at library\std\src\fs\tests.rs:2242:43:
called `Result::unwrap()` on an `Err` value: Os { code: 4392, kind: Uncategorized, message: "The data present in the reparse point buffer is invalid." }
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::result::unwrap_failed
   3: <<alloc::boxed::Box<dyn core::error::Error + core::marker::Sync + core::marker::Send> as core::convert::From<alloc::string::String>>::from::StringError as core::fmt::Debug>::fmt
   4: <rand_xorshift::XorShiftRng as rand_core::SeedableRng>::from_seed
   5: core::slice::sort::unstable::heapsort::heapsort::<usize, <usize as core::cmp::PartialOrd>::lt>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- fs::tests::test_rename_junction stdout end ----

failures:
    fs::tests::create_dir_all_with_junctions
---

error: test failed, to rerun pass `-p std --lib`
Bootstrap failed while executing `test --stage 2 --skip=compiler --skip=src --skip=src/tools/linkchecker`
Build completed unsuccessfully in 1:32:45
make: *** [Makefile:115: ci-msvc-py] Error 1
  local time: Wed Jul  1 19:40:43 CUT 2026
  network time: Wed, 01 Jul 2026 19:40:43 GMT
##[error]Process completed with exit code 2.
##[group]Run echo "disk usage:"
echo "disk usage:"

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job x86_64-msvc-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
failures:

---- fs::tests::create_dir_all_with_junctions stdout ----

thread 'fs::tests::create_dir_all_with_junctions' (7112) panicked at library\std\src\fs\tests.rs:1710:5:
junction_point(&target, &junction) failed with: The data present in the reparse point buffer is invalid. (os error 4392)
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: <<alloc::boxed::Box<dyn core::error::Error + core::marker::Sync + core::marker::Send> as core::convert::From<alloc::string::String>>::from::StringError as core::fmt::Debug>::fmt
   3: <rand_xorshift::XorShiftRng as rand_core::SeedableRng>::from_seed
   4: core::slice::sort::unstable::heapsort::heapsort::<usize, <usize as core::cmp::PartialOrd>::lt>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- fs::tests::create_dir_all_with_junctions stdout end ----
---- fs::tests::recursive_rmdir stdout ----

thread 'fs::tests::recursive_rmdir' (1916) panicked at library\std\src\fs\tests.rs:905:5:
junction_point(&d2, &dt.join("d2")) failed with: The data present in the reparse point buffer is invalid. (os error 4392)
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: <<alloc::boxed::Box<dyn core::error::Error + core::marker::Sync + core::marker::Send> as core::convert::From<alloc::string::String>>::from::StringError as core::fmt::Debug>::fmt
   3: <rand_xorshift::XorShiftRng as rand_core::SeedableRng>::from_seed
   4: core::slice::sort::unstable::heapsort::heapsort::<usize, <usize as core::cmp::PartialOrd>::lt>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- fs::tests::recursive_rmdir stdout end ----
---- fs::tests::recursive_rmdir_of_symlink stdout ----

thread 'fs::tests::recursive_rmdir_of_symlink' (4144) panicked at library\std\src\fs\tests.rs:926:5:
junction_point(&dir, &link) failed with: The data present in the reparse point buffer is invalid. (os error 4392)
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: <<alloc::boxed::Box<dyn core::error::Error + core::marker::Sync + core::marker::Send> as core::convert::From<alloc::string::String>>::from::StringError as core::fmt::Debug>::fmt
   3: <rand_xorshift::XorShiftRng as rand_core::SeedableRng>::from_seed
   4: core::slice::sort::unstable::heapsort::heapsort::<usize, <usize as core::cmp::PartialOrd>::lt>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- fs::tests::recursive_rmdir_of_symlink stdout end ----
---- fs::tests::test_rename_junction stdout ----

thread 'fs::tests::test_rename_junction' (7528) panicked at library\std\src\fs\tests.rs:2242:43:
called `Result::unwrap()` on an `Err` value: Os { code: 4392, kind: Uncategorized, message: "The data present in the reparse point buffer is invalid." }
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::result::unwrap_failed
   3: <<alloc::boxed::Box<dyn core::error::Error + core::marker::Sync + core::marker::Send> as core::convert::From<alloc::string::String>>::from::StringError as core::fmt::Debug>::fmt
   4: <rand_xorshift::XorShiftRng as rand_core::SeedableRng>::from_seed
   5: core::slice::sort::unstable::heapsort::heapsort::<usize, <usize as core::cmp::PartialOrd>::lt>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- fs::tests::test_rename_junction stdout end ----

failures:
    fs::tests::create_dir_all_with_junctions
---

error: test failed, to rerun pass `-p std --lib`
Bootstrap failed while executing `test --stage 2 --skip=compiler --skip=src --skip=src/tools/linkchecker`
Build completed unsuccessfully in 2:00:12
make: *** [Makefile:115: ci-msvc-py] Error 1
  local time: Wed Jul  1 21:25:55 CUT 2026
  network time: Wed, 01 Jul 2026 21:25:55 GMT
##[error]Process completed with exit code 2.
##[group]Run echo "disk usage:"
echo "disk usage:"

@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 Jul 1, 2026
@rust-bors

rust-bors Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

💔 Test for ffe100d failed: CI. Failed job:

@jhpratt jhpratt closed this Jul 1, 2026
@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 Jul 1, 2026
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 1, 2026
@rust-bors

rust-bors Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved due to being closed.

@rust-bors

rust-bors Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 51cf4eb failed: CI. Failed jobs:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. rollup A PR which is a rollup S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.