Skip to content

Commit a0b58ba

Browse files
committed
rustup: update to nightly-2025-04-13.
1 parent 8971fe4 commit a0b58ba

File tree

13 files changed

+73
-84
lines changed

13 files changed

+73
-84
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-03-29"
21+
channel = "nightly-2025-04-13"
2222
components = ["rust-src", "rustc-dev", "llvm-tools"]
23-
# commit_hash = 920d95eaf23d7eb6b415d09868e4f793024fa604"#;
23+
# commit_hash = 9ffde4b089fe8e43d5891eb517001df27a8443ff"#;
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/builder/builder_methods.rs

Lines changed: 31 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3349,7 +3349,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
33493349
pieces_len_id,
33503350
rt_args_slice_ptr_id,
33513351
rt_args_len_id,
3352-
_fmt_placeholders_slice_ptr_id,
3352+
fmt_placeholders_slice_ptr_id,
33533353
fmt_placeholders_len_id,
33543354
] if (pieces_len, rt_args_count) == (!0, !0) => {
33553355
let [pieces_len, rt_args_len, fmt_placeholders_len] = match [
@@ -3369,56 +3369,40 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
33693369
}
33703370
};
33713371

3372-
// FIXME(eddyb) simplify the logic below after
3373-
// https://github.com/rust-lang/rust/pull/139131
3374-
// (~1.88) as it makes `&[rt::Placeholder]`
3375-
// constant (via promotion to 'static).
3376-
3377-
// HACK(eddyb) this accounts for all of these:
3378-
// - `rt::Placeholder` copies into array: 2 insts each
3379-
// - `rt::UnsafeArg::new()` call: 1 inst
3380-
// - runtime args array->slice ptr cast: 1 inst
3381-
// - placeholders array->slice ptr cast: 1 inst
3382-
let extra_insts = try_rev_take(3 + fmt_placeholders_len * 2).ok_or_else(|| {
3372+
let prepare_args_insts = try_rev_take(3).ok_or_else(|| {
33833373
FormatArgsNotRecognized(
33843374
"fmt::Arguments::new_v1_formatted call: ran out of instructions".into(),
33853375
)
33863376
})?;
3387-
let rt_args_slice_ptr_id = match extra_insts[..] {
3388-
[.., Inst::Bitcast(out_id, in_id), Inst::Bitcast(..)]
3389-
if out_id == rt_args_slice_ptr_id =>
3390-
{
3391-
in_id
3392-
}
3393-
_ => {
3394-
let mut insts = extra_insts;
3395-
insts.extend(fmt_args_new_call_insts);
3396-
return Err(FormatArgsNotRecognized(format!(
3397-
"fmt::Arguments::new_v1_formatted call sequence ({insts:?})",
3398-
)));
3399-
}
3400-
};
3401-
3402-
// HACK(eddyb) even worse, each call made to
3403-
// `rt::Placeholder::new(...)` takes anywhere
3404-
// between 8 and 16 instructions each, due
3405-
// to `rt::Count`'s `enum` representation.
3406-
for _ in 0..fmt_placeholders_len {
3407-
try_rev_take(4).and_then(|_| {
3408-
for _ in 0..2 {
3409-
if let [Inst::Bitcast(..), _] = try_rev_take(2)?[..] {
3410-
try_rev_take(4)?;
3411-
}
3377+
let (rt_args_slice_ptr_id, _fmt_placeholders_slice_ptr_id) =
3378+
match prepare_args_insts[..] {
3379+
[
3380+
// HACK(eddyb) `rt::UnsafeArg::new()` call
3381+
// (`unsafe` ZST "constructor").
3382+
Inst::Call(_, _, ref rt_unsafe_arg_call_args),
3383+
Inst::Bitcast(
3384+
rt_args_cast_out_id,
3385+
rt_args_cast_in_id,
3386+
),
3387+
Inst::Bitcast(
3388+
placeholders_cast_out_id,
3389+
placeholders_cast_in_id,
3390+
),
3391+
] if rt_unsafe_arg_call_args.is_empty()
3392+
&& rt_args_cast_out_id == rt_args_slice_ptr_id
3393+
&& placeholders_cast_out_id
3394+
== fmt_placeholders_slice_ptr_id =>
3395+
{
3396+
(rt_args_cast_in_id, placeholders_cast_in_id)
34123397
}
3413-
Some(())
3414-
})
3415-
.ok_or_else(|| {
3416-
FormatArgsNotRecognized(
3417-
"fmt::rt::Placeholder::new call: ran out of instructions"
3418-
.into(),
3419-
)
3420-
})?;
3421-
}
3398+
_ => {
3399+
let mut insts = prepare_args_insts;
3400+
insts.extend(fmt_args_new_call_insts);
3401+
return Err(FormatArgsNotRecognized(format!(
3402+
"fmt::Arguments::new_v1_formatted call sequence ({insts:?})",
3403+
)));
3404+
}
3405+
};
34223406

34233407
decoded_format_args
34243408
.has_unknown_fmt_placeholder_to_args_mapping =
@@ -3707,7 +3691,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
37073691
let force_warn = |span, msg| -> rustc_errors::Diag<'_, ()> {
37083692
rustc_errors::Diag::new(
37093693
self.tcx.dcx(),
3710-
rustc_errors::Level::ForceWarning(None),
3694+
rustc_errors::Level::ForceWarning,
37113695
msg,
37123696
)
37133697
.with_span(span)

crates/rustc_codegen_spirv/src/lib.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#![cfg_attr(doc, recursion_limit = "256")] // FIXME(nnethercote): will be removed by #124141
66
#![feature(assert_matches)]
77
#![feature(box_patterns)]
8-
#![feature(debug_closure_helpers)]
98
#![feature(file_buffered)]
109
#![feature(if_let_guard)]
1110
#![feature(let_chains)]
@@ -374,9 +373,11 @@ impl WriteBackendMethods for SpirvCodegenBackend {
374373
module: ModuleCodegen<Self::Module>,
375374
_config: &ModuleConfig,
376375
) -> Result<CompiledModule, FatalError> {
377-
let path = cgcx
378-
.output_filenames
379-
.temp_path(OutputType::Object, Some(&module.name));
376+
let path = cgcx.output_filenames.temp_path_for_cgu(
377+
OutputType::Object,
378+
&module.name,
379+
cgcx.invocation_temp.as_deref(),
380+
);
380381
// Note: endianness doesn't matter, readers deduce endianness from magic header.
381382
let spirv_module = spirv_tools::binary::from_binary(&module.module_llvm);
382383
File::create(&path)

crates/rustc_codegen_spirv/src/link.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,12 @@ pub fn link(
6565

6666
if outputs.outputs.should_codegen() {
6767
let out_filename = out_filename(sess, crate_type, outputs, Symbol::intern(crate_name));
68-
let out_filename_file_for_writing =
69-
out_filename.file_for_writing(outputs, OutputType::Exe, None);
68+
let out_filename_file_for_writing = out_filename.file_for_writing(
69+
outputs,
70+
OutputType::Exe,
71+
crate_name,
72+
sess.invocation_temp.as_deref(),
73+
);
7074
match crate_type {
7175
CrateType::Rlib => {
7276
link_rlib(sess, codegen_results, &out_filename_file_for_writing);
@@ -137,7 +141,7 @@ fn link_rlib(sess: &Session, codegen_results: &CodegenResults, out_filename: &Pa
137141

138142
create_archive(
139143
&file_list,
140-
codegen_results.metadata.raw_data(),
144+
codegen_results.metadata.stub_or_full(),
141145
out_filename,
142146
);
143147
}

crates/rustc_codegen_spirv/src/linker/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ pub fn link(
496496
let (spv_words, module_or_err, lower_from_spv_timer) =
497497
spv_module_to_spv_words_and_spirt_module(&output);
498498
let module = &mut module_or_err.map_err(|e| {
499-
let spv_path = outputs.temp_path_ext("spirt-lower-from-spv-input.spv", None);
499+
let spv_path = outputs.temp_path_for_diagnostic("spirt-lower-from-spv-input.spv");
500500

501501
let was_saved_msg =
502502
match std::fs::write(&spv_path, spirv_tools::binary::from_binary(&spv_words)) {
@@ -787,7 +787,7 @@ impl Drop for SpirtDumpGuard<'_> {
787787
self.per_pass_module_for_dumping
788788
.push(("", self.module.clone()));
789789
}
790-
dump_spirt_file_path = Some(self.outputs.temp_path_ext("spirt", None));
790+
dump_spirt_file_path = Some(self.outputs.temp_path_for_diagnostic("spirt"));
791791
}
792792

793793
if let Some(dump_spirt_file_path) = &dump_spirt_file_path {

crates/rustc_codegen_spirv/src/linker/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ fn link_with_linker_opts(
143143
hash_kind: sopts.unstable_opts.src_hash_algorithm(&target),
144144
checksum_hash_kind: None,
145145
};
146-
rustc_span::create_session_globals_then(sopts.edition, Some(sm_inputs), || {
146+
rustc_span::create_session_globals_then(sopts.edition, &[], Some(sm_inputs), || {
147147
let mut sess = rustc_session::build_session(
148148
sopts,
149149
CompilerIO {

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-03-29"
2+
channel = "nightly-2025-04-13"
33
components = ["rust-src", "rustc-dev", "llvm-tools"]
4-
# commit_hash = 920d95eaf23d7eb6b415d09868e4f793024fa604
4+
# commit_hash = 9ffde4b089fe8e43d5891eb517001df27a8443ff
55

66
# Whenever changing the nightly channel, update the commit hash above, and make
77
# sure to change `REQUIRED_TOOLCHAIN` in `crates/rustc_codegen_spirv/build.rs` also.

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/intrinsics/mod.rs:3854:9
2+
--> $CORE_SRC/intrinsics/mod.rs:3805:9
33
|
4-
3854 | copy(src, dst, count)
4+
3805 | copy(src, dst, count)
55
| ^^^^^^^^^^^^^^^^^^^^^
66
|
77
note: used from within `core::intrinsics::copy::<f32>`
8-
--> $CORE_SRC/intrinsics/mod.rs:3834:21
8+
--> $CORE_SRC/intrinsics/mod.rs:3785:21
99
|
10-
3834 | pub const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) {
10+
3785 | 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/intrinsics/mod.rs:3842:9
31+
--> $CORE_SRC/intrinsics/mod.rs:3793:9
3232
|
33-
3842 | / ub_checks::assert_unsafe_precondition!(
34-
3843 | | check_language_ub,
35-
3844 | | "ptr::copy requires that both pointer arguments are aligned and non-null",
33+
3793 | / ub_checks::assert_unsafe_precondition!(
34+
3794 | | check_language_ub,
35+
3795 | | "ptr::copy requires that both pointer arguments are aligned and non-null",
3636
... |
37-
3852 | | && ub_checks::maybe_is_aligned_and_not_null(dst, align, zero_size)
38-
3853 | | );
37+
3803 | | && ub_checks::maybe_is_aligned_and_not_null(dst, align, zero_size)
38+
3804 | | );
3939
| |_________^
4040
|
4141
note: used from within `core::intrinsics::copy::<f32>`
42-
--> $CORE_SRC/intrinsics/mod.rs:3842:9
42+
--> $CORE_SRC/intrinsics/mod.rs:3793:9
4343
|
44-
3842 | / ub_checks::assert_unsafe_precondition!(
45-
3843 | | check_language_ub,
46-
3844 | | "ptr::copy requires that both pointer arguments are aligned and non-null",
44+
3793 | / ub_checks::assert_unsafe_precondition!(
45+
3794 | | check_language_ub,
46+
3795 | | "ptr::copy requires that both pointer arguments are aligned and non-null",
4747
... |
48-
3852 | | && ub_checks::maybe_is_aligned_and_not_null(dst, align, zero_size)
49-
3853 | | );
48+
3803 | | && ub_checks::maybe_is_aligned_and_not_null(dst, align, zero_size)
49+
3804 | | );
5050
| |_________^
5151
note: called by `ptr_copy::copy_via_raw_ptr`
5252
--> $DIR/ptr_copy.rs:28:18

tests/compiletests/ui/dis/ptr_copy.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ use spirv_std::spirv;
1111
fn copy_via_raw_ptr(src: &f32, dst: &mut f32) {
1212
#[cfg(via_intrinsic)]
1313
{
14-
extern "rust-intrinsic" {
15-
fn copy<T>(src: *const T, dst: *mut T, count: usize);
16-
}
14+
#[rustc_intrinsic]
15+
unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize);
16+
1717
unsafe { copy(src, dst, 1) }
1818
}
1919

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 1380 8
5+
OpLine %8 1420 8
66
%9 = OpLoad %10 %4
77
OpLine %11 7 13
88
OpStore %6 %9

0 commit comments

Comments
 (0)