Skip to content

Update toolchain nightly-2026-03-14#545

Open
LegNeato wants to merge 43 commits intomainfrom
pr-542-latest-nightly-refresh
Open

Update toolchain nightly-2026-03-14#545
LegNeato wants to merge 43 commits intomainfrom
pr-542-latest-nightly-refresh

Conversation

@LegNeato
Copy link
Collaborator

@LegNeato LegNeato commented Mar 7, 2026

_args: &[OperandRef<'tcx, Self::Value>],
_is_cleanup: bool,
) -> Self::Value {
bug!("LLVM intrinsic call not supported in SPIR-V backend: {instance:?}")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want to use this rather than our own home-grown replacements, but didn't want to do it in this PR.

@LegNeato LegNeato force-pushed the pr-542-latest-nightly-refresh branch from 14cdf92 to 6434ab8 Compare March 7, 2026 00:22
@nazar-pc
Copy link
Contributor

nazar-pc commented Mar 7, 2026

cargo-gpu will need to be updated again to match this, custom target specs since recently require an unstable CLI option:

error: `.json` target specs require -Zjson-target-spec

@nazar-pc
Copy link
Contributor

nazar-pc commented Mar 8, 2026

Tried to update with a patched cargo-gpu locally and it worked, but generated these warnings that were not present before:

Details
warning: failed to find and remove `format_args!` construction for this `panic!`
    --> /home/nazar-pc/.rustup/toolchains/nightly-2026-03-06-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:2086:9
     |
2086 | /         ub_checks::assert_unsafe_precondition!(
2087 | |             check_language_ub,
2088 | |             "ptr::read_volatile requires that the pointer argument is aligned",
...    |
2092 | |             ) => ub_checks::maybe_is_aligned(addr, align)
2093 | |         );
     | |_________^
     |
     = note: compilation may later fail due to leftover `format_args!` internals
     = note: [RUST-GPU BUG] bailed from panic entry-point call args

warning: failed to find and remove `format_args!` construction for this `panic!`
   --> /home/nazar-pc/.rustup/toolchains/nightly-2026-03-06-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:531:5
    |
531 | /     ub_checks::assert_unsafe_precondition!(
532 | |         check_language_ub,
533 | |         "ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null \
534 | |         and the specified memory ranges do not overlap",
...   |
547 | |     );
    | |_____^
    |
    = note: compilation may later fail due to leftover `format_args!` internals
    = note: [RUST-GPU BUG] bailed from panic entry-point call args

warning: failed to find and remove `format_args!` construction for this `panic!`
   --> /home/nazar-pc/.rustup/toolchains/nightly-2026-03-06-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/index.rs:240:9
    |
240 | /         assert_unsafe_precondition!(
241 | |             check_language_ub, // okay because of the `assume` below
242 | |             "slice::get_unchecked requires that the index is within the slice",
243 | |             (this: usize = self, len: usize = slice.len()) => this < len
244 | |         );
    | |_________^
    |
    = note: compilation may later fail due to leftover `format_args!` internals
    = note: [RUST-GPU BUG] bailed from fmt::Arguments::new call sequence ([Call(59851, 1387, [3516, 3517])])

warning: failed to find and remove `format_args!` construction for this `panic!`
   --> /home/nazar-pc/.rustup/toolchains/nightly-2026-03-06-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/index.rs:240:9
    |
240 | /         assert_unsafe_precondition!(
241 | |             check_language_ub, // okay because of the `assume` below
242 | |             "slice::get_unchecked requires that the index is within the slice",
243 | |             (this: usize = self, len: usize = slice.len()) => this < len
244 | |         );
    | |_________^
    |
    = note: compilation may later fail due to leftover `format_args!` internals
    = note: [RUST-GPU BUG] bailed from fmt::Arguments::new call sequence ([Call(59882, 1390, [3522, 3523])])

warning: failed to find and remove `format_args!` construction for this `panic!`
   --> /home/nazar-pc/.rustup/toolchains/nightly-2026-03-06-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/index.rs:260:9
    |
260 | /         assert_unsafe_precondition!(
261 | |             check_library_ub,
262 | |             "slice::get_unchecked_mut requires that the index is within the slice",
263 | |             (this: usize = self, len: usize = slice.len()) => this < len
264 | |         );
    | |_________^
    |
    = note: compilation may later fail due to leftover `format_args!` internals
    = note: [RUST-GPU BUG] bailed from fmt::Arguments::new call sequence ([Call(59911, 1381, [3527, 3528])])

warning: failed to find and remove `format_args!` construction for this `panic!`
   --> /home/nazar-pc/.rustup/toolchains/nightly-2026-03-06-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/index.rs:240:9
    |
240 | /         assert_unsafe_precondition!(
241 | |             check_language_ub, // okay because of the `assume` below
242 | |             "slice::get_unchecked requires that the index is within the slice",
243 | |             (this: usize = self, len: usize = slice.len()) => this < len
244 | |         );
    | |_________^
    |
    = note: compilation may later fail due to leftover `format_args!` internals
    = note: [RUST-GPU BUG] bailed from fmt::Arguments::new call sequence ([Call(59936, 1393, [3533, 3534])])

warning: failed to find and remove `format_args!` construction for this `panic!`
   --> /home/nazar-pc/.rustup/toolchains/nightly-2026-03-06-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/index.rs:240:9
    |
240 | /         assert_unsafe_precondition!(
241 | |             check_language_ub, // okay because of the `assume` below
242 | |             "slice::get_unchecked requires that the index is within the slice",
243 | |             (this: usize = self, len: usize = slice.len()) => this < len
244 | |         );
    | |_________^
    |
    = note: compilation may later fail due to leftover `format_args!` internals
    = note: [RUST-GPU BUG] bailed from fmt::Arguments::new call sequence ([Call(59967, 1396, [3539, 3540])])

warning: failed to find and remove `format_args!` construction for this `panic!`
   --> /home/nazar-pc/.rustup/toolchains/nightly-2026-03-06-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/index.rs:240:9
    |
240 | /         assert_unsafe_precondition!(
241 | |             check_language_ub, // okay because of the `assume` below
242 | |             "slice::get_unchecked requires that the index is within the slice",
243 | |             (this: usize = self, len: usize = slice.len()) => this < len
244 | |         );
    | |_________^
    |
    = note: compilation may later fail due to leftover `format_args!` internals
    = note: [RUST-GPU BUG] bailed from fmt::Arguments::new call sequence ([Call(59998, 1399, [3545, 3546])])

warning: failed to find and remove `format_args!` construction for this `panic!`
   --> /home/nazar-pc/.rustup/toolchains/nightly-2026-03-06-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/index.rs:260:9
    |
260 | /         assert_unsafe_precondition!(
261 | |             check_library_ub,
262 | |             "slice::get_unchecked_mut requires that the index is within the slice",
263 | |             (this: usize = self, len: usize = slice.len()) => this < len
264 | |         );
    | |_________^
    |
    = note: compilation may later fail due to leftover `format_args!` internals
    = note: [RUST-GPU BUG] bailed from fmt::Arguments::new call sequence ([Call(60027, 1384, [3550, 3551])])

warning: failed to find and remove `format_args!` construction for this `panic!`
   --> /home/nazar-pc/.rustup/toolchains/nightly-2026-03-06-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/index.rs:240:9
    |
240 | /         assert_unsafe_precondition!(
241 | |             check_language_ub, // okay because of the `assume` below
242 | |             "slice::get_unchecked requires that the index is within the slice",
243 | |             (this: usize = self, len: usize = slice.len()) => this < len
244 | |         );
    | |_________^
    |
    = note: compilation may later fail due to leftover `format_args!` internals
    = note: [RUST-GPU BUG] bailed from fmt::Arguments::new call sequence ([Call(60052, 1402, [3556, 3557])])

warning: failed to find and remove `format_args!` construction for this `panic!`
   --> /home/nazar-pc/.rustup/toolchains/nightly-2026-03-06-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/index.rs:326:9
    |
326 | /         assert_unsafe_precondition!(
327 | |             check_library_ub,
328 | |             "slice::get_unchecked_mut requires that the index is within the slice",
329 | |             (end: usize = self.end(), len: usize = slice.len()) => end <= len
330 | |         );
    | |_________^
    |
    = note: compilation may later fail due to leftover `format_args!` internals
    = note: [RUST-GPU BUG] bailed from fmt::Arguments::new call sequence ([Call(60985, 1071, [60970]), Call(60988, 1378, [3948, 3949])])

@nazar-pc nazar-pc mentioned this pull request Mar 8, 2026
@LegNeato
Copy link
Collaborator Author

LegNeato commented Mar 8, 2026

Cool, I'll take a look. There were some changes in this area.

LegNeato added 23 commits March 10, 2026 17:47
This disassembly test only cares about the rotate lowering pattern, not source
line tables. Strip OpLine records entirely so line-number drift across toolchains
does not require reblessing the test.
@LegNeato LegNeato changed the title Update toolchain 2026-03-06 Update toolchain nightly-2026-03-14 Mar 14, 2026
@fee1-dead
Copy link
Collaborator

cc @Firestar99 for some testing

@LegNeato
Copy link
Collaborator Author

@Firestar99 did you get a chance to test this?

Add a UI compile-fail test for casting a 3-byte constant allocation to `*const RuntimeArray<u16>`. This exercises the existing trailing-bytes diagnostic for unsupported unsized constants and guards the review concern that this shape must fail instead of silently lowering.
Copy link
Collaborator

@fee1-dead fee1-dead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, had one last nit, otherwise this is ready to go and feel free to merge after CI green and testing (cc @Firestar99?)!

Comment on lines +356 to +350
&& let Some(init) = self.try_read_from_const_alloc(alloc, pointee)
{
return self.static_addr_of(init, alloc.inner().align, None);
if let Some(init) = self.try_read_from_const_alloc(alloc, pointee) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should move back to the let chain instead of putting another check inside.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generic unsized constant reader already handles `RuntimeArray` constants, including the trailing-bytes error case covered by the new compile-fail test. Keep `const_bitcast` on the direct `try_read_from_const_alloc` path instead of carrying a second fallback that no longer changes behavior.
@LegNeato LegNeato force-pushed the pr-542-latest-nightly-refresh branch from ed2c27e to 3cce05f Compare March 23, 2026 05:56
@Firestar99
Copy link
Member

Looks like cargo-gpu needs an update to work with this branch... I'll have a look tomorrow (and properly review this)

@Firestar99
Copy link
Member

Firestar99 commented Mar 24, 2026

I found a good counter argument against updating to "in the middle" nightlies:

https://github.com/Rust-GPU/cargo-gpu/blob/7f1995823a82ee6e6b7a63b57313c4a829856e3d/.github/workflows/push.yaml#L56-L76

These are 4 old rust-gpu versions we no longer test cargo-gpu against due to them failing, of which 2 are broken due to using in-the-middle nightlies:

  • ❌ 0.8.0: cargo-gpu builds rust-gpu without lockfiles, and these old cargo versions aren't msrv-aware, so it upgraded zmij to a too new version
  • ✔️ cc75231 serde starts using #[diagnostic] attributes as it detects rustc 1.78.0. We're on nightly-2024-03-01, #[diagnostic] got stabilized on 2024-03-08 and rustc 1.78.0 branched on 2024-03-15
  • 02cefd1 fails as target specs mismatch, they get changed a few commits later so I didn't bother
  • ✔️ bbb61f5 proc-macro2 starts using proc_macro::Literal::byte_character (from rustc_private proc_macro crate), stabilized in rustc 1.79.0. We're on nightly-2024-03-21, proc_macro::Literal::byte_character was stabilized on 2024-04-04 and rustc 1.79.0 branched on 2024-04-26.

These never showed up to end users since these revs are mostly in the middle of PR #249, the edition 2025 toolchain upgrade. I've specifically chosen to test revs before and after target spec changes to make sure (past) cargo-gpu's / (now) spirv-builder's backwards compat towards older rust-gpu versions works, as these are the most likely to break. (Also this PR is also not backwards compatible, see Rust-GPU/cargo-gpu@1e4487e ci failing, will fix soon)

This could also be fixed by making cargo-gpu's "rustc-codegen-spirv build" use rust-gpu's lockfile, and thus never use never deps then what we're using right now.

Firestar99 added a commit to Rust-GPU/cargo-gpu that referenced this pull request Mar 24, 2026
@Firestar99 Firestar99 force-pushed the pr-542-latest-nightly-refresh branch 2 times, most recently from 9e3bb73 to c8078ed Compare March 24, 2026 13:23
Firestar99 added a commit to Rust-GPU/cargo-gpu that referenced this pull request Mar 24, 2026
@Firestar99 Firestar99 force-pushed the pr-542-latest-nightly-refresh branch from c8078ed to 99993ee Compare March 25, 2026 09:56
Firestar99 added a commit to Rust-GPU/cargo-gpu that referenced this pull request Mar 25, 2026
@Firestar99 Firestar99 force-pushed the pr-542-latest-nightly-refresh branch from 99993ee to 12762d7 Compare March 25, 2026 09:57
Firestar99 added a commit to Rust-GPU/cargo-gpu that referenced this pull request Mar 25, 2026
Copy link
Member

@Firestar99 Firestar99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a read though it, skipping the format_args_disassembler cause that's entirely @eddyb's domain (I merely moved it to a separate mod at some point, if it shows me as having changed it).

Added some commits to make it work with cargo-gpu's backwards compat requirements.

Works for restir, nanite-at-home, rust-gpu-templates and builds nazar's abundance.

Still think we shouldn't upgrade to middle nightlies, see comment above.

Revert the `const_str` reshaping and the direct `RuntimeArray` constant-loading path in `read_from_const_alloc_at`. This restores the older behavior of treating `RuntimeArray` constants as unsupported instead of trying to materialize them from Rust constant data.
Remove the compile-fail test that casts constant data to `*const RuntimeArray<T>`. We do not want to support constructing `RuntimeArray` from Rust constant data.
@LegNeato
Copy link
Collaborator Author

LegNeato commented Mar 25, 2026

Still think we shouldn't upgrade to middle nightlies, see comment above.

I don't want to optimize for cargo-gpu, I want to optimize for tracking nightly and detecting issues in upstream ASAP and perhaps having upstream revert or workaround rather than us dealing with them months later once things have solidified. cargo-gpu isn't even technically in alpha, it is on a best effort basis.

In my ideal world we are tracking rustc master. Perhaps this means cargo-gpu needs to be merged into this repo so users can depend on the same rev and have it all work (but have cargo-gpu able to compile with stable). I am not sure, that then feels a bit like SpirvBuilder? I feel like a tool that was supposed to be an add-on to make things easier is now a critical piece and seems to be slowing down the main project before we have even officially released it. That is not good.

@nazar-pc
Copy link
Contributor

Perhaps this means cargo-gpu needs to be merged into this repo

Yes, please 🙏

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.

4 participants