-
Notifications
You must be signed in to change notification settings - Fork 106
Update toolchain nightly-2026-03-14 #545
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 32 commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
aa9ef5e
Update pinned toolchain to nightly-2026-03-06
LegNeato 2de9db3
Port backend trait surface to rustc 1.96 APIs
LegNeato 285545f
Port backend internals and ABI plumbing to latest nightly
LegNeato be7148b
Handle newer panic format_args lowering patterns
LegNeato 771aa99
Handle nightly panic format_args lowering and unsized const reification
LegNeato 0453c80
Fix new nightly clippy suggestions in type trie and linker
LegNeato 543eb26
Port linker test harness to current rustc session APIs
LegNeato a303ad3
Resolve new collapsible-match clippy lints in example runners
LegNeato c70cdc3
Guard runtime-array const reification against truncation and ZST tails
LegNeato a8b858a
Replace fmt::Arguments sentinel metadata with typed constructor tags
LegNeato 2af3b54
Gate bounds/precondition panic-entry detection to non-local core symbols
LegNeato 1c64a85
Fix panic-entry matching and disable-pqp unused-features lint
LegNeato 6c9a7b4
Bless compiletest stderr for updated nightly diagnostics
LegNeato e0ef82c
Rustfmt codegen_cx panic-entry matcher formatting
LegNeato d5b1aef
spirv-builder: pass -Zjson-target-spec for JSON targets
LegNeato 65058a9
compiletests: bless sampled image query_size_lod stderr
LegNeato 5795f08
codegen: adapt panic format_args decompiler for new nightly shapes
LegNeato 3ae3af3
codegen: stop treating core precondition_check as panic entry point
LegNeato 7669aa1
codegen: harden panic format_args fallback for split/pass-through shapes
LegNeato 899a7b0
codegen: preserve raw fn ABI query invariants
LegNeato 156887d
codegen: harden panic message decoding for nightly call shapes
LegNeato facad7d
codegen: preserve panic_const messages in panic fast path
LegNeato b4a6a4c
codegen: decode panic_bounds_check debug-printf args
LegNeato e900eb2
compiletests: normalize relative spirv-std paths in stderr
LegNeato c3cedf9
fix lint and spv1.3 stderr for panic/message updates
LegNeato 12cc6a9
codegen: use size-based alloca for panic arg spill
LegNeato 12c5bb4
codegen: emit typed local panic spills without typed_alloca
LegNeato f9d718f
codegen: align funclet stubs and likely handling notes
LegNeato 203c750
codegen: fix panic entry-point classification and arg decoding
LegNeato 2f54cdf
codegen: match likely/unlikely via intrinsic symbols
LegNeato ee49a27
compiletests: update ptr_copy stderr for extra pointer-cast diagnostic
LegNeato db063f6
style: run cargo fmt --all
LegNeato bbe7d17
build: sync crate attrs with nightly-2026-03-14
LegNeato e63081b
codegen: update attr handling for rustc 1d8897a4e
LegNeato 1d679e9
consts: diagnose invalid runtime-array const bitcasts
LegNeato 51193ef
compiletests: normalize issue-1062 OpLine output
LegNeato 1bc950c
Remove duplicate PassMode::Direct check
LegNeato e0d2e20
compiletests: cover invalid runtime-array const bitcasts
LegNeato 3cce05f
consts: remove dead runtime-array const bitcast fallback
LegNeato 85cd195
std: remove unused features rustc warns about
Firestar99 12762d7
spirv-builder: make required extra arg `-Zjson-target-spec` backwards…
Firestar99 711cc8f
consts: stop reifying RuntimeArray constant data
LegNeato df3e0ce
compiletests: drop RuntimeArray const-bitcast misuse case
LegNeato File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,14 +13,15 @@ use rustc_abi::{ | |
| use rustc_data_structures::fx::FxHashMap; | ||
| use rustc_errors::ErrorGuaranteed; | ||
| use rustc_index::Idx; | ||
| use rustc_middle::query::Providers; | ||
| use rustc_middle::ty::layout::{FnAbiOf, LayoutOf, TyAndLayout}; | ||
| use rustc_middle::ty::{ | ||
| self, Const, CoroutineArgs, CoroutineArgsExt as _, FloatTy, IntTy, PolyFnSig, Ty, TyCtxt, | ||
| TyKind, UintTy, | ||
| TyKind, UintTy, ValTreeKindExt, | ||
| }; | ||
| use rustc_middle::ty::{GenericArgsRef, ScalarInt}; | ||
| use rustc_middle::util::Providers; | ||
| use rustc_middle::{bug, span_bug}; | ||
| use rustc_session::config::OptLevel; | ||
| use rustc_span::DUMMY_SP; | ||
| use rustc_span::def_id::DefId; | ||
| use rustc_span::{Span, Symbol}; | ||
|
|
@@ -29,6 +30,19 @@ use std::cell::RefCell; | |
| use std::collections::hash_map::Entry; | ||
| use std::fmt; | ||
|
|
||
| fn rewrite_c_abi_to_rust<'tcx>( | ||
| fn_sig: ty::EarlyBinder<'tcx, ty::PolyFnSig<'tcx>>, | ||
| ) -> ty::EarlyBinder<'tcx, ty::PolyFnSig<'tcx>> { | ||
| fn_sig.map_bound(|outer| { | ||
| outer.map_bound(|mut inner| { | ||
| if let Abi::C { .. } = inner.abi { | ||
| inner.abi = Abi::Rust; | ||
| } | ||
| inner | ||
| }) | ||
| }) | ||
| } | ||
|
|
||
| pub(crate) fn provide(providers: &mut Providers) { | ||
| // This is a lil weird: so, we obviously don't support C ABIs at all. However, libcore does declare some extern | ||
| // C functions: | ||
|
|
@@ -44,18 +58,19 @@ pub(crate) fn provide(providers: &mut Providers) { | |
| // NOTE: this used to rewrite to `extern "unadjusted"`, but rustc now | ||
| // validates `#[rustc_pass_indirectly_in_non_rustic_abis]` for non-Rust ABIs, | ||
| // and `Unadjusted` does not satisfy that requirement. | ||
| providers.fn_sig = |tcx, def_id| { | ||
| providers.queries.fn_sig = |tcx, def_id| { | ||
| // We can't capture the old fn_sig and just call that, because fn_sig is a `fn`, not a `Fn`, i.e. it can't | ||
| // capture variables. Fortunately, the defaults are exposed (thanks rustdoc), so use that instead. | ||
| let result = (rustc_interface::DEFAULT_QUERY_PROVIDERS.fn_sig)(tcx, def_id); | ||
| result.map_bound(|outer| { | ||
| outer.map_bound(|mut inner| { | ||
| if let Abi::C { .. } = inner.abi { | ||
| inner.abi = Abi::Rust; | ||
| } | ||
| inner | ||
| }) | ||
| }) | ||
| let result = (rustc_interface::DEFAULT_QUERY_PROVIDERS.queries.fn_sig)(tcx, def_id); | ||
| rewrite_c_abi_to_rust(result) | ||
| }; | ||
| providers.extern_queries.fn_sig = |tcx, def_id| { | ||
| // We can't capture the old fn_sig and just call that, because fn_sig is a `fn`, not a `Fn`, i.e. it can't | ||
| // capture variables. Fortunately, the defaults are exposed (thanks rustdoc), so use that instead. | ||
| let result = (rustc_interface::DEFAULT_QUERY_PROVIDERS | ||
| .extern_queries | ||
| .fn_sig)(tcx, def_id); | ||
| rewrite_c_abi_to_rust(result) | ||
| }; | ||
|
|
||
| // For the Rust ABI, `FnAbi` adjustments are backend-agnostic, but they will | ||
|
|
@@ -67,7 +82,7 @@ pub(crate) fn provide(providers: &mut Providers) { | |
| fn_abi: &'tcx FnAbi<'tcx, Ty<'tcx>>, | ||
| ) -> &'tcx FnAbi<'tcx, Ty<'tcx>> { | ||
| let readjust_arg_abi = |arg: &ArgAbi<'tcx, Ty<'tcx>>| { | ||
| let mut arg = ArgAbi::new(&tcx, arg.layout, |_, _, _| ArgAttributes::new()); | ||
| let mut arg = ArgAbi::new(&tcx, arg.layout, |_, _| ArgAttributes::new()); | ||
| // FIXME: this is bad! https://github.com/rust-lang/rust/issues/115666 | ||
| // <https://github.com/rust-lang/rust/commit/eaaa03faf77b157907894a4207d8378ecaec7b45> | ||
| arg.make_direct_deprecated(); | ||
|
|
@@ -86,6 +101,12 @@ pub(crate) fn provide(providers: &mut Providers) { | |
| arg.mode = PassMode::Ignore; | ||
| } | ||
|
|
||
| // SPIR-V backend lowers arguments by-value and cannot handle | ||
| // backend-specific indirection/casts at this layer. | ||
| if matches!(arg.mode, PassMode::Cast { .. } | PassMode::Indirect { .. }) { | ||
| arg.mode = PassMode::Direct(ArgAttributes::new()); | ||
| } | ||
|
|
||
| arg | ||
| }; | ||
| tcx.arena.alloc(FnAbi { | ||
|
|
@@ -101,12 +122,30 @@ pub(crate) fn provide(providers: &mut Providers) { | |
| can_unwind: fn_abi.can_unwind, | ||
| }) | ||
| } | ||
| providers.fn_abi_of_fn_ptr = |tcx, key| { | ||
| let result = (rustc_interface::DEFAULT_QUERY_PROVIDERS.fn_abi_of_fn_ptr)(tcx, key); | ||
| providers.queries.fn_abi_of_fn_ptr = |tcx, key| { | ||
| let result = (rustc_interface::DEFAULT_QUERY_PROVIDERS | ||
| .queries | ||
| .fn_abi_of_fn_ptr)(tcx, key); | ||
| Ok(readjust_fn_abi(tcx, result?)) | ||
| }; | ||
| providers.fn_abi_of_instance = |tcx, key| { | ||
| let result = (rustc_interface::DEFAULT_QUERY_PROVIDERS.fn_abi_of_instance)(tcx, key); | ||
| providers.queries.fn_abi_of_instance_no_deduced_attrs = |tcx, key| { | ||
| let result = (rustc_interface::DEFAULT_QUERY_PROVIDERS | ||
| .queries | ||
| .fn_abi_of_instance_no_deduced_attrs)(tcx, key); | ||
| // Keep this query in its original shape while `fn_abi_of_instance_raw` | ||
| // is being computed: rustc validates strict invariants there. | ||
| // Otherwise, if `fn_abi_of_instance` would route through this query | ||
| // directly (e.g. incremental or opt-level=0), apply SPIR-V readjustment. | ||
| if tcx.sess.opts.optimize != OptLevel::No && tcx.sess.opts.incremental.is_none() { | ||
| result | ||
| } else { | ||
| Ok(readjust_fn_abi(tcx, result?)) | ||
| } | ||
| }; | ||
| providers.queries.fn_abi_of_instance_raw = |tcx, key| { | ||
| let result = (rustc_interface::DEFAULT_QUERY_PROVIDERS | ||
| .queries | ||
| .fn_abi_of_instance_raw)(tcx, key); | ||
| Ok(readjust_fn_abi(tcx, result?)) | ||
| }; | ||
|
|
||
|
|
@@ -116,7 +155,7 @@ pub(crate) fn provide(providers: &mut Providers) { | |
| // | ||
| // FIXME(eddyb) same as the FIXME comment on `check_well_formed`: | ||
| // need to migrate away from `#[repr(simd)]` ASAP. | ||
| providers.check_mono_item = |_, _| {}; | ||
| providers.queries.check_mono_item = |_, _| {}; | ||
| } | ||
|
|
||
| /// If a struct contains a pointer to itself, even indirectly, then doing a naiive recursive walk | ||
|
|
@@ -291,6 +330,7 @@ impl<'tcx> ConvSpirvType<'tcx> for TyAndLayout<'tcx> { | |
| span = cx.tcx.def_span(adt.did()); | ||
| } | ||
|
|
||
| #[allow(deprecated)] | ||
| let attrs = AggregatedSpirvAttributes::parse(cx, cx.tcx.get_all_attrs(adt.did())); | ||
|
LegNeato marked this conversation as resolved.
Outdated
|
||
|
|
||
| if let Some(intrinsic_type_attr) = attrs.intrinsic_type.map(|attr| attr.value) | ||
|
|
@@ -395,6 +435,10 @@ impl<'tcx> ConvSpirvType<'tcx> for TyAndLayout<'tcx> { | |
| } | ||
| .def(span, cx) | ||
| } | ||
| BackendRepr::ScalableVector { .. } => cx | ||
| .tcx | ||
| .dcx() | ||
| .fatal("scalable vectors are not supported in SPIR-V backend"), | ||
| BackendRepr::Memory { sized: _ } => trans_aggregate(cx, span, *self), | ||
| } | ||
| } | ||
|
|
@@ -614,22 +658,11 @@ fn trans_aggregate<'tcx>(cx: &CodegenCx<'tcx>, span: Span, ty: TyAndLayout<'tcx> | |
| .def(span, cx) | ||
| } | ||
| } | ||
| FieldsShape::Arbitrary { | ||
| offsets: _, | ||
| memory_index: _, | ||
| } => trans_struct_or_union(cx, span, ty, None), | ||
| FieldsShape::Arbitrary { .. } => trans_struct_or_union(cx, span, ty, None), | ||
| } | ||
| } | ||
|
|
||
| #[cfg_attr( | ||
| not(rustc_codegen_spirv_disable_pqp_cg_ssa), | ||
| expect( | ||
| unused, | ||
| reason = "actually used from \ | ||
| `<rustc_codegen_ssa::traits::ConstCodegenMethods for CodegenCx<'_>>::const_struct`, \ | ||
| but `rustc_codegen_ssa` being `pqp_cg_ssa` makes that trait unexported" | ||
| ) | ||
| )] | ||
| #[cfg_attr(not(rustc_codegen_spirv_disable_pqp_cg_ssa), allow(unused))] | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if |
||
| // returns (field_offsets, size, align) | ||
| pub fn auto_struct_layout( | ||
| cx: &CodegenCx<'_>, | ||
|
|
@@ -866,7 +899,8 @@ fn trans_intrinsic_type<'tcx>( | |
| } = const_.to_value(); | ||
| assert!(const_ty.is_integral()); | ||
| const_val | ||
| .try_to_scalar_int() | ||
| .try_to_scalar() | ||
| .and_then(|scalar| scalar.try_to_scalar_int().ok()) | ||
| .and_then(P::from_scalar_int) | ||
| .ok_or_else(|| { | ||
| cx.tcx | ||
|
|
||
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.