Skip to content

update to rustc 1.99.0 - #630

Draft
Firestar99 wants to merge 6 commits into
nightly-2026-06-09from
nightly_1.99.0
Draft

update to rustc 1.99.0#630
Firestar99 wants to merge 6 commits into
nightly-2026-06-09from
nightly_1.99.0

Conversation

@Firestar99

@Firestar99 Firestar99 commented Jul 16, 2026

Copy link
Copy Markdown
Member

Requires #612

Warning

This is an in-the-middle nightly

Notes:

  • seeing a couple weird compiletest failures, I suspect something changed upstream...

@Firestar99
Firestar99 changed the base branch from main to nightly-2026-06-09 July 16, 2026 13:40
@Firestar99 Firestar99 changed the title Nightly 1.99.0 update to rustc 1.99.0 Jul 16, 2026
@nazar-pc

nazar-pc commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Further bump would be nice, nightly-2026-07-22 introduced macroless_generic_const_args that improved const generics substantially over earlier nightlies.

And for me personally unmerged PRs are not that useful since I can't rely on commits that can disappear any time.

@Firestar99

Copy link
Copy Markdown
Member Author

afaik github never deletes commits (except when explicitly requested), so any hashes you grab from a repo will always remain valid, even if this PR is rebased.

@Firestar99

Firestar99 commented Aug 7, 2026

Copy link
Copy Markdown
Member Author

The version I just pushed is completely broken after nightly-2025-07-19 (inclusive)

Upstream commit rust-lang/rust@d93df7f is causing the breakage, even though it looks completely innocent cleanup. Instead of asking the codegen backend for whether some value is an immediate or scalar pair, it removes those APIs to instead just query it directly from BackendRepr. The implementation we and llvm and gcc had is the exact same one they're using, so there's seemingly no semantic change there.

But all compiles are failing with an ICE here:

e(SpirvValue { kind: Def(1137), ty: 1134 }) @ TyAndLayout { ty: math::libm_math::support::big::u256, layout: Layout { size: Size(32 bytes), align: AbiAlign { abi: Align(8 bytes) }, backend_repr: ScalarPair { a: Initialized { value: Int(I128, false), valid_range: 0..=340282366920938463463374607431768211455 }, b: Initialized { value: Int(I128, false), valid_range: 0..=340282366920938463463374607431768211455 }, b_offset: Size(16 bytes) }, fields: Arbitrary { offsets: [Size(0 bytes), Size(16 bytes)], in_memory_order: [0, 1] }, largest_niche: None, uninhabited: false, variants: Single { index: 0 }, max_repr_align: None, unadjusted_abi_align: Align(8 bytes), randomization_seed: 17996504725788008022 } })): not applicable
  --> /home/firestar99/.rustup/toolchains/nightly-2026-07-19-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/compiler-builtins/compiler-builtins/src/math/../../../libm/src/math/support/big.rs:28:5
   |
28 | /     pub fn signed(self) -> i256 {
29 | |         i256 {
30 | |             lo: self.lo,
31 | |             hi: self.hi as i128,
32 | |         }
33 | |     }
   | |_____^


thread 'rustc' (819536) panicked at /home/firestar99/workspace/rust-gpu/target/release/build/rustc_codegen_spirv-d246d51479a59b87/out/pqp_cg_ssa/src/mir/operand.rs:423:21:
Box<dyn Any>
stack backtrace:
[...]
  16:     0x75e402e148e8 - rustc_middle[96c442875f2cb62c]::util::bug::span_bug_fmt::<rustc_span[157f53c51de8f998]::span_encoding::Span>
  17:     0x75e3f2d0019b - <rustc_codegen_spirv[36c5a3c0a874027]::maybe_pqp_cg_ssa::mir::operand::OperandRef<rustc_codegen_spirv[36c5a3c0a874027]::builder_spirv::SpirvValue>>::extract_field::<rustc_codegen_spirv[36c5a3c0a874027]::builder::Builder>
  18:     0x75e3f2a8f808 - <rustc_codegen_spirv[36c5a3c0a874027]::maybe_pqp_cg_ssa::mir::FunctionCx<rustc_codegen_spirv[36c5a3c0a874027]::builder::Builder>>::codegen_consume
  19:     0x75e3f2a9011c - <rustc_codegen_spirv[36c5a3c0a874027]::maybe_pqp_cg_ssa::mir::FunctionCx<rustc_codegen_spirv[36c5a3c0a874027]::builder::Builder>>::codegen_operand
  20:     0x75e3f2a79262 - rustc_codegen_spirv[36c5a3c0a874027]::maybe_pqp_cg_ssa::mir::codegen_mir::<rustc_codegen_spirv[36c5a3c0a874027]::builder::Builder>
  21:     0x75e3f2af90f1 - rustc_codegen_spirv[36c5a3c0a874027]::maybe_pqp_cg_ssa::base::codegen_instance::<rustc_codegen_spirv[36c5a3c0a874027]::builder::Builder>
  22:     0x75e3f29b2827 - <rustc_middle[96c442875f2cb62c]::mono::MonoItem as rustc_codegen_spirv[36c5a3c0a874027]::maybe_pqp_cg_ssa::mono_item::MonoItemExt>::define::<rustc_codegen_spirv[36c5a3c0a874027]::builder::Builder>
  23:     0x75e3f2b8aea5 - <rustc_codegen_spirv[36c5a3c0a874027]::SpirvCodegenBackend as rustc_codegen_spirv[36c5a3c0a874027]::maybe_pqp_cg_ssa::traits::backend::ExtraBackendMethods>::compile_codegen_unit::{closure#0}
  24:     0x75e3f2b8cd1d - <rustc_codegen_spirv[36c5a3c0a874027]::SpirvCodegenBackend as rustc_codegen_spirv[36c5a3c0a874027]::maybe_pqp_cg_ssa::traits::backend::ExtraBackendMethods>::compile_codegen_unit
  25:     0x75e3f2af895b - rustc_codegen_spirv[36c5a3c0a874027]::maybe_pqp_cg_ssa::base::codegen_crate::<rustc_codegen_spirv[36c5a3c0a874027]::SpirvCodegenBackend, rspirv[3ee83ac1199cf24a]::dr::constructs::Module>
  26:     0x75e3f2b8b4cd - <rustc_codegen_spirv[36c5a3c0a874027]::SpirvCodegenBackend as rustc_codegen_spirv[36c5a3c0a874027]::maybe_pqp_cg_ssa::traits::backend::CodegenBackend>::codegen_crate
  27:     0x75e406819ca4 - <rustc_interface[bb04609e4c960450]::queries::Linker>::codegen_and_build_linker
  28:     0x75e40690470e - rustc_interface[bb04609e4c960450]::interface::run_compiler::<(), rustc_driver_impl[c2a64f8504684822]::run_compiler::{closure#0}>::{closure#2}
  29:     0x75e406972ae4 - std[2a8c3cd46992084f]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[bb04609e4c960450]::util::run_in_thread_with_globals<rustc_interface[bb04609e4c960450]::util::run_in_thread_pool_with_globals<rustc_interface[bb04609e4c960450]::interface::run_compiler<(), rustc_driver_impl[c2a64f8504684822]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  30:     0x75e4069728bb - <std[2a8c3cd46992084f]::thread::lifecycle::spawn_unchecked<rustc_interface[bb04609e4c960450]::util::run_in_thread_with_globals<rustc_interface[bb04609e4c960450]::util::run_in_thread_pool_with_globals<rustc_interface[bb04609e4c960450]::interface::run_compiler<(), rustc_driver_impl[c2a64f8504684822]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[f0447a45d83adb47]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  31:     0x75e40697cec8 - <std[2a8c3cd46992084f]::sys::thread::unix::Thread>::new::thread_start
  32:     0x75e40029dd53 - start_thread
  33:     0x75e40032563c - __clone3
  34:                0x0 - <unknown>

This function wasn't changed in the mentioned commit. But if you look at the match statement:

let (in_scalar, imm) = match (self.val, self.layout.backend_repr) {
    // Extract a scalar component from a pair.
    (
        OperandValue::Pair(a_llval, b_llval),
        BackendRepr::ScalarPair { a, b, b_offset },
    ) => {

The issue is that we have an OperandValue::Pair with a BackendRepr::Immediate due to us patching scalar pairs to immediates:

// FIXME(eddyb) detect `#[rust_gpu::vector::v1]` more specifically,
// to avoid affecting anything should actually be passed as a pair.
if let PassMode::Pair(..) = arg.mode {
    // HACK(eddyb) this avoids breaking e.g. `&[T]` pairs.
    if let TyKind::Adt(..) = arg.layout.ty.kind() {
        arg.mode = PassMode::Direct(ArgAttributes::new());
    }
}

EDIT: was added in PR #437

Removing that makes it "work" again, with around 50 compiletest failing on function calls, so removing this isn't trivial. But may very well be necessary going forward, as we're hit problems due to this patching many times.

So going forward we could:

  • try to patch all the cases where cg_ssa is failing due to our patch, who knows how many more patches it'll be in the future?
  • I have yet to pin point the exact reason it's starting to fail to patch just that
  • remove the abi patching and make our codegen backend without it

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.

2 participants