Skip to content

Commit ebc0a05

Browse files
committed
Update to nightly-2025-07-28.
- `run_fat_lto`, `optimize_fat`, and `autodiff` were merged into `run_and_optimize_fat_lto`, and the parameters were changed. - `run_thin_lto` parameters were changed. - `codegen` parameters were changed. - `LtoModuleCodegen` was removed. - Minor error message changes: - Some line number changes in rustc. - Some error message wording tweaks. The LTO changes occurred in rust-lang/rust PR 143388 and PR 144062.
1 parent f7c1ab1 commit ebc0a05

File tree

10 files changed

+63
-75
lines changed

10 files changed

+63
-75
lines changed

crates/rustc_codegen_spirv/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ use std::{env, fs, mem};
1818
/// `cargo publish`. We need to figure out a way to do this properly, but let's hardcode it for now :/
1919
//const REQUIRED_RUST_TOOLCHAIN: &str = include_str!("../../rust-toolchain.toml");
2020
const REQUIRED_RUST_TOOLCHAIN: &str = r#"[toolchain]
21-
channel = "nightly-2025-07-14"
21+
channel = "nightly-2025-07-28"
2222
components = ["rust-src", "rustc-dev", "llvm-tools"]
23-
# commit_hash = e9182f195b8505c87c4bd055b9f6e114ccda0981"#;
23+
# commit_hash = f8e355c230c6eb7b78ffce6a92fd81f78c890524"#;
2424

2525
fn rustc_output(arg: &str) -> Result<String, Box<dyn Error>> {
2626
let rustc = env::var("RUSTC").unwrap_or_else(|_| "rustc".into());

crates/rustc_codegen_spirv/src/lib.rs

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ mod target_feature;
141141

142142
use builder::Builder;
143143
use codegen_cx::CodegenCx;
144-
use maybe_pqp_cg_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule};
144+
use maybe_pqp_cg_ssa::back::lto::{SerializedModule, ThinModule};
145145
use maybe_pqp_cg_ssa::back::write::{
146146
CodegenContext, FatLtoInput, ModuleConfig, OngoingCodegen, TargetMachineFactoryConfig,
147147
};
@@ -170,7 +170,7 @@ use std::any::Any;
170170
use std::fs;
171171
use std::io::Cursor;
172172
use std::io::Write;
173-
use std::path::Path;
173+
use std::path::{Path, PathBuf};
174174
use std::sync::Arc;
175175
use tracing::{error, warn};
176176

@@ -333,7 +333,7 @@ impl WriteBackendMethods for SpirvCodegenBackend {
333333
type ThinBuffer = SpirvModuleBuffer;
334334

335335
// FIXME(eddyb) reuse the "merge" stage of `crate::linker` for this, or even
336-
// delegate to `run_fat_lto` (although `-Zcombine-cgu` is much more niche).
336+
// delegate to `run_and_optimize_fat_lto` (although `-Zcombine-cgu` is much more niche).
337337
fn run_link(
338338
cgcx: &CodegenContext<Self>,
339339
diag_handler: DiagCtxtHandle<'_>,
@@ -351,24 +351,29 @@ impl WriteBackendMethods for SpirvCodegenBackend {
351351
// consider setting `requires_lto = true` in the target specs and moving the
352352
// entirety of `crate::linker` into this stage (lacking diagnostics may be
353353
// an issue - it's surprising `CodegenBackend::link` has `Session` at all).
354-
fn run_fat_lto(
354+
fn run_and_optimize_fat_lto(
355355
cgcx: &CodegenContext<Self>,
356+
_exported_symbols_for_lto: &[String],
357+
_each_linked_rlib_for_lto: &[PathBuf],
356358
_modules: Vec<FatLtoInput<Self>>,
357-
_cached_modules: Vec<(SerializedModule<Self::ModuleBuffer>, WorkProduct)>,
358-
) -> Result<LtoModuleCodegen<Self>, FatalError> {
359+
_diff_fncs: Vec<AutoDiffItem>,
360+
) -> Result<ModuleCodegen<Self::Module>, FatalError> {
359361
assert!(
360362
cgcx.lto == rustc_session::config::Lto::Fat,
361-
"`run_fat_lto` (for `WorkItemResult::NeedsFatLto`) should \
363+
"`run_and_optimize_fat_lto` (for `WorkItemResult::NeedsFatLto`) should \
362364
only be invoked due to `-Clto` (or equivalent)"
363365
);
364366
unreachable!("Rust-GPU does not support fat LTO")
365367
}
366368

367369
fn run_thin_lto(
368370
cgcx: &CodegenContext<Self>,
371+
// FIXME(bjorn3): Limit LTO exports to these symbols
372+
_exported_symbols_for_lto: &[String],
373+
_each_linked_rlib_for_lto: &[PathBuf], // njn: ?
369374
modules: Vec<(String, Self::ThinBuffer)>,
370375
cached_modules: Vec<(SerializedModule<Self::ModuleBuffer>, WorkProduct)>,
371-
) -> Result<(Vec<LtoModuleCodegen<Self>>, Vec<WorkProduct>), FatalError> {
376+
) -> Result<(Vec<ThinModule<Self>>, Vec<WorkProduct>), FatalError> {
372377
link::run_thin(cgcx, modules, cached_modules)
373378
}
374379

@@ -409,16 +414,8 @@ impl WriteBackendMethods for SpirvCodegenBackend {
409414
Ok(module)
410415
}
411416

412-
fn optimize_fat(
413-
cgcx: &CodegenContext<Self>,
414-
module: &mut ModuleCodegen<Self::Module>,
415-
) -> Result<(), FatalError> {
416-
Self::optimize_common(cgcx, module)
417-
}
418-
419417
fn codegen(
420418
cgcx: &CodegenContext<Self>,
421-
_diag_handler: DiagCtxtHandle<'_>,
422419
module: ModuleCodegen<Self::Module>,
423420
_config: &ModuleConfig,
424421
) -> Result<CompiledModule, FatalError> {
@@ -457,15 +454,6 @@ impl WriteBackendMethods for SpirvCodegenBackend {
457454
SpirvModuleBuffer(module.module_llvm.assemble()),
458455
)
459456
}
460-
461-
fn autodiff(
462-
_cgcx: &CodegenContext<Self>,
463-
_module: &ModuleCodegen<Self::Module>,
464-
_diff_fncs: Vec<AutoDiffItem>,
465-
_config: &ModuleConfig,
466-
) -> Result<(), FatalError> {
467-
unreachable!("Rust-GPU does not support autodiff")
468-
}
469457
}
470458

471459
impl ExtraBackendMethods for SpirvCodegenBackend {

crates/rustc_codegen_spirv/src/link.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rspirv::binary::Assemble;
88
use rspirv::dr::Module;
99
use rustc_ast::CRATE_NODE_ID;
1010
use rustc_codegen_spirv_types::{CompileResult, ModuleResult};
11-
use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule, ThinShared};
11+
use rustc_codegen_ssa::back::lto::{SerializedModule, ThinModule, ThinShared};
1212
use rustc_codegen_ssa::back::write::CodegenContext;
1313
use rustc_codegen_ssa::{CodegenResults, NativeLib};
1414
use rustc_data_structures::fx::FxHashSet;
@@ -634,7 +634,7 @@ pub(crate) fn run_thin(
634634
cgcx: &CodegenContext<SpirvCodegenBackend>,
635635
modules: Vec<(String, SpirvModuleBuffer)>,
636636
cached_modules: Vec<(SerializedModule<SpirvModuleBuffer>, WorkProduct)>,
637-
) -> Result<(Vec<LtoModuleCodegen<SpirvCodegenBackend>>, Vec<WorkProduct>), FatalError> {
637+
) -> Result<(Vec<ThinModule<SpirvCodegenBackend>>, Vec<WorkProduct>), FatalError> {
638638
if cgcx.opts.cg.linker_plugin_lto.enabled() {
639639
unreachable!("We should never reach this case if the LTO step is deferred to the linker");
640640
}
@@ -668,10 +668,10 @@ pub(crate) fn run_thin(
668668

669669
let mut opt_jobs = vec![];
670670
for (module_index, _) in shared.module_names.iter().enumerate() {
671-
opt_jobs.push(LtoModuleCodegen::Thin(ThinModule {
671+
opt_jobs.push(ThinModule {
672672
shared: shared.clone(),
673673
idx: module_index,
674-
}));
674+
});
675675
}
676676

677677
Ok((opt_jobs, vec![]))

rust-toolchain.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[toolchain]
2-
channel = "nightly-2025-07-14"
2+
channel = "nightly-2025-07-28"
33
components = ["rust-src", "rustc-dev", "llvm-tools"]
4-
# commit_hash = e9182f195b8505c87c4bd055b9f6e114ccda0981
4+
# commit_hash = f8e355c230c6eb7b78ffce6a92fd81f78c890524
55

66
# Whenever changing the nightly channel, update the commit hash above, and
77
# change `REQUIRED_RUST_TOOLCHAIN` in `crates/rustc_codegen_spirv/build.rs` too.

tests/compiletests/ui/dis/ptr_copy.normal.stderr

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
error: cannot memcpy dynamically sized data
2-
--> $CORE_SRC/ptr/mod.rs:633:9
2+
--> $CORE_SRC/ptr/mod.rs:638:9
33
|
4-
633 | crate::intrinsics::copy(src, dst, count)
4+
638 | crate::intrinsics::copy(src, dst, count)
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
note: used from within `core::ptr::copy::<f32>`
8-
--> $CORE_SRC/ptr/mod.rs:618:21
8+
--> $CORE_SRC/ptr/mod.rs:623:21
99
|
10-
618 | pub const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) {
10+
623 | pub const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) {
1111
| ^^^^
1212
note: called by `ptr_copy::copy_via_raw_ptr`
1313
--> $DIR/ptr_copy.rs:28:18
@@ -28,25 +28,25 @@ note: called by `main`
2828
error: cannot cast between pointer types
2929
from `*f32`
3030
to `*struct () { }`
31-
--> $CORE_SRC/ptr/mod.rs:621:9
31+
--> $CORE_SRC/ptr/mod.rs:626:9
3232
|
33-
621 | / ub_checks::assert_unsafe_precondition!(
34-
622 | | check_language_ub,
35-
623 | | "ptr::copy requires that both pointer arguments are aligned and non-null",
33+
626 | / ub_checks::assert_unsafe_precondition!(
34+
627 | | check_language_ub,
35+
628 | | "ptr::copy requires that both pointer arguments are aligned and non-null",
3636
... |
37-
631 | | && ub_checks::maybe_is_aligned_and_not_null(dst, align, zero_size)
38-
632 | | );
37+
636 | | && ub_checks::maybe_is_aligned_and_not_null(dst, align, zero_size)
38+
637 | | );
3939
| |_________^
4040
|
4141
note: used from within `core::ptr::copy::<f32>`
42-
--> $CORE_SRC/ptr/mod.rs:621:9
42+
--> $CORE_SRC/ptr/mod.rs:626:9
4343
|
44-
621 | / ub_checks::assert_unsafe_precondition!(
45-
622 | | check_language_ub,
46-
623 | | "ptr::copy requires that both pointer arguments are aligned and non-null",
44+
626 | / ub_checks::assert_unsafe_precondition!(
45+
627 | | check_language_ub,
46+
628 | | "ptr::copy requires that both pointer arguments are aligned and non-null",
4747
... |
48-
631 | | && ub_checks::maybe_is_aligned_and_not_null(dst, align, zero_size)
49-
632 | | );
48+
636 | | && ub_checks::maybe_is_aligned_and_not_null(dst, align, zero_size)
49+
637 | | );
5050
| |_________^
5151
note: called by `ptr_copy::copy_via_raw_ptr`
5252
--> $DIR/ptr_copy.rs:28:18

tests/compiletests/ui/dis/ptr_read.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
%4 = OpFunctionParameter %5
33
%6 = OpFunctionParameter %5
44
%7 = OpLabel
5-
OpLine %8 1732 8
5+
OpLine %8 1737 8
66
%9 = OpLoad %10 %4
77
OpLine %11 7 13
88
OpStore %6 %9

tests/compiletests/ui/dis/ptr_read_method.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
%4 = OpFunctionParameter %5
33
%6 = OpFunctionParameter %5
44
%7 = OpLabel
5-
OpLine %8 1732 8
5+
OpLine %8 1737 8
66
%9 = OpLoad %10 %4
77
OpLine %11 7 13
88
OpStore %6 %9

tests/compiletests/ui/dis/ptr_write.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
%7 = OpLabel
55
OpLine %8 7 35
66
%9 = OpLoad %10 %4
7-
OpLine %11 1932 8
7+
OpLine %11 1937 8
88
OpStore %6 %9
99
OpNoLine
1010
OpReturn

tests/compiletests/ui/dis/ptr_write_method.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
%7 = OpLabel
55
OpLine %8 7 37
66
%9 = OpLoad %10 %4
7-
OpLine %11 1932 8
7+
OpLine %11 1937 8
88
OpStore %6 %9
99
OpNoLine
1010
OpReturn

tests/compiletests/ui/spirv-attr/invalid-target.stderr

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,67 +1030,67 @@ error: attribute is only valid on a function parameter, not on a struct field
10301030
170 | uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
10311031
| ^^^^^^^^^
10321032

1033-
error: attribute is only valid on a struct, not on a implementation block
1033+
error: attribute is only valid on a struct, not on a inherent implementation block
10341034
--> $DIR/invalid-target.rs:176:5
10351035
|
10361036
176 | sampler, block, sampled_image, generic_image_type, // struct-only
10371037
| ^^^^^^^
10381038

1039-
error: attribute is only valid on a struct, not on a implementation block
1039+
error: attribute is only valid on a struct, not on a inherent implementation block
10401040
--> $DIR/invalid-target.rs:176:14
10411041
|
10421042
176 | sampler, block, sampled_image, generic_image_type, // struct-only
10431043
| ^^^^^
10441044

1045-
error: attribute is only valid on a struct, not on a implementation block
1045+
error: attribute is only valid on a struct, not on a inherent implementation block
10461046
--> $DIR/invalid-target.rs:176:21
10471047
|
10481048
176 | sampler, block, sampled_image, generic_image_type, // struct-only
10491049
| ^^^^^^^^^^^^^
10501050

1051-
error: attribute is only valid on a struct, not on a implementation block
1051+
error: attribute is only valid on a struct, not on a inherent implementation block
10521052
--> $DIR/invalid-target.rs:176:36
10531053
|
10541054
176 | sampler, block, sampled_image, generic_image_type, // struct-only
10551055
| ^^^^^^^^^^^^^^^^^^
10561056

1057-
error: attribute is only valid on a function, not on a implementation block
1057+
error: attribute is only valid on a function, not on a inherent implementation block
10581058
--> $DIR/invalid-target.rs:177:5
10591059
|
10601060
177 | vertex, // fn-only
10611061
| ^^^^^^
10621062

1063-
error: attribute is only valid on a function parameter, not on a implementation block
1063+
error: attribute is only valid on a function parameter, not on a inherent implementation block
10641064
--> $DIR/invalid-target.rs:178:5
10651065
|
10661066
178 | uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
10671067
| ^^^^^^^
10681068

1069-
error: attribute is only valid on a function parameter, not on a implementation block
1069+
error: attribute is only valid on a function parameter, not on a inherent implementation block
10701070
--> $DIR/invalid-target.rs:178:14
10711071
|
10721072
178 | uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
10731073
| ^^^^^^^^
10741074

1075-
error: attribute is only valid on a function parameter, not on a implementation block
1075+
error: attribute is only valid on a function parameter, not on a inherent implementation block
10761076
--> $DIR/invalid-target.rs:178:24
10771077
|
10781078
178 | uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
10791079
| ^^^^^^^^^^^^^^^^^^
10801080

1081-
error: attribute is only valid on a function parameter, not on a implementation block
1081+
error: attribute is only valid on a function parameter, not on a inherent implementation block
10821082
--> $DIR/invalid-target.rs:178:44
10831083
|
10841084
178 | uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
10851085
| ^^^^^^^^^^^
10861086

1087-
error: attribute is only valid on a function parameter, not on a implementation block
1087+
error: attribute is only valid on a function parameter, not on a inherent implementation block
10881088
--> $DIR/invalid-target.rs:178:57
10891089
|
10901090
178 | uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
10911091
| ^^^^
10921092

1093-
error: attribute is only valid on a function parameter, not on a implementation block
1093+
error: attribute is only valid on a function parameter, not on a inherent implementation block
10941094
--> $DIR/invalid-target.rs:178:63
10951095
|
10961096
178 | uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
@@ -1228,67 +1228,67 @@ error: attribute is only valid on a function parameter, not on a trait
12281228
205 | uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
12291229
| ^^^^^^^^^
12301230

1231-
error: attribute is only valid on a struct, not on a implementation block
1231+
error: attribute is only valid on a struct, not on a trait implementation block
12321232
--> $DIR/invalid-target.rs:237:5
12331233
|
12341234
237 | sampler, block, sampled_image, generic_image_type, // struct-only
12351235
| ^^^^^^^
12361236

1237-
error: attribute is only valid on a struct, not on a implementation block
1237+
error: attribute is only valid on a struct, not on a trait implementation block
12381238
--> $DIR/invalid-target.rs:237:14
12391239
|
12401240
237 | sampler, block, sampled_image, generic_image_type, // struct-only
12411241
| ^^^^^
12421242

1243-
error: attribute is only valid on a struct, not on a implementation block
1243+
error: attribute is only valid on a struct, not on a trait implementation block
12441244
--> $DIR/invalid-target.rs:237:21
12451245
|
12461246
237 | sampler, block, sampled_image, generic_image_type, // struct-only
12471247
| ^^^^^^^^^^^^^
12481248

1249-
error: attribute is only valid on a struct, not on a implementation block
1249+
error: attribute is only valid on a struct, not on a trait implementation block
12501250
--> $DIR/invalid-target.rs:237:36
12511251
|
12521252
237 | sampler, block, sampled_image, generic_image_type, // struct-only
12531253
| ^^^^^^^^^^^^^^^^^^
12541254

1255-
error: attribute is only valid on a function, not on a implementation block
1255+
error: attribute is only valid on a function, not on a trait implementation block
12561256
--> $DIR/invalid-target.rs:238:5
12571257
|
12581258
238 | vertex, // fn-only
12591259
| ^^^^^^
12601260

1261-
error: attribute is only valid on a function parameter, not on a implementation block
1261+
error: attribute is only valid on a function parameter, not on a trait implementation block
12621262
--> $DIR/invalid-target.rs:239:5
12631263
|
12641264
239 | uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
12651265
| ^^^^^^^
12661266

1267-
error: attribute is only valid on a function parameter, not on a implementation block
1267+
error: attribute is only valid on a function parameter, not on a trait implementation block
12681268
--> $DIR/invalid-target.rs:239:14
12691269
|
12701270
239 | uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
12711271
| ^^^^^^^^
12721272

1273-
error: attribute is only valid on a function parameter, not on a implementation block
1273+
error: attribute is only valid on a function parameter, not on a trait implementation block
12741274
--> $DIR/invalid-target.rs:239:24
12751275
|
12761276
239 | uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
12771277
| ^^^^^^^^^^^^^^^^^^
12781278

1279-
error: attribute is only valid on a function parameter, not on a implementation block
1279+
error: attribute is only valid on a function parameter, not on a trait implementation block
12801280
--> $DIR/invalid-target.rs:239:44
12811281
|
12821282
239 | uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
12831283
| ^^^^^^^^^^^
12841284

1285-
error: attribute is only valid on a function parameter, not on a implementation block
1285+
error: attribute is only valid on a function parameter, not on a trait implementation block
12861286
--> $DIR/invalid-target.rs:239:57
12871287
|
12881288
239 | uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only
12891289
| ^^^^
12901290

1291-
error: attribute is only valid on a function parameter, not on a implementation block
1291+
error: attribute is only valid on a function parameter, not on a trait implementation block
12921292
--> $DIR/invalid-target.rs:239:63
12931293
|
12941294
239 | uniform, position, descriptor_set = 0, binding = 0, flat, invariant, // param-only

0 commit comments

Comments
 (0)