Skip to content

Commit 81b2921

Browse files
committed
rustup: update to nightly-2025-04-13.
1 parent 36e6f95 commit 81b2921

File tree

13 files changed

+75
-90
lines changed

13 files changed

+75
-90
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: 33 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -658,12 +658,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
658658
if !indices.is_empty() {
659659
// HACK(eddyb) Cargo silences warnings in dependencies.
660660
let force_warn = |span, msg| -> rustc_errors::Diag<'_, ()> {
661-
rustc_errors::Diag::new(
662-
self.tcx.dcx(),
663-
rustc_errors::Level::ForceWarning(None),
664-
msg,
665-
)
666-
.with_span(span)
661+
rustc_errors::Diag::new(self.tcx.dcx(), rustc_errors::Level::ForceWarning, msg)
662+
.with_span(span)
667663
};
668664
force_warn(
669665
self.span(),
@@ -3391,7 +3387,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
33913387
pieces_len_id,
33923388
rt_args_slice_ptr_id,
33933389
rt_args_len_id,
3394-
_fmt_placeholders_slice_ptr_id,
3390+
fmt_placeholders_slice_ptr_id,
33953391
fmt_placeholders_len_id,
33963392
] if (pieces_len, rt_args_count) == (!0, !0) => {
33973393
let [pieces_len, rt_args_len, fmt_placeholders_len] = match [
@@ -3411,56 +3407,40 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
34113407
}
34123408
};
34133409

3414-
// FIXME(eddyb) simplify the logic below after
3415-
// https://github.com/rust-lang/rust/pull/139131
3416-
// (~1.88) as it makes `&[rt::Placeholder]`
3417-
// constant (via promotion to 'static).
3418-
3419-
// HACK(eddyb) this accounts for all of these:
3420-
// - `rt::Placeholder` copies into array: 2 insts each
3421-
// - `rt::UnsafeArg::new()` call: 1 inst
3422-
// - runtime args array->slice ptr cast: 1 inst
3423-
// - placeholders array->slice ptr cast: 1 inst
3424-
let extra_insts = try_rev_take(3 + fmt_placeholders_len * 2).ok_or_else(|| {
3410+
let prepare_args_insts = try_rev_take(3).ok_or_else(|| {
34253411
FormatArgsNotRecognized(
34263412
"fmt::Arguments::new_v1_formatted call: ran out of instructions".into(),
34273413
)
34283414
})?;
3429-
let rt_args_slice_ptr_id = match extra_insts[..] {
3430-
[.., Inst::Bitcast(out_id, in_id), Inst::Bitcast(..)]
3431-
if out_id == rt_args_slice_ptr_id =>
3432-
{
3433-
in_id
3434-
}
3435-
_ => {
3436-
let mut insts = extra_insts;
3437-
insts.extend(fmt_args_new_call_insts);
3438-
return Err(FormatArgsNotRecognized(format!(
3439-
"fmt::Arguments::new_v1_formatted call sequence ({insts:?})",
3440-
)));
3441-
}
3442-
};
3443-
3444-
// HACK(eddyb) even worse, each call made to
3445-
// `rt::Placeholder::new(...)` takes anywhere
3446-
// between 8 and 16 instructions each, due
3447-
// to `rt::Count`'s `enum` representation.
3448-
for _ in 0..fmt_placeholders_len {
3449-
try_rev_take(4).and_then(|_| {
3450-
for _ in 0..2 {
3451-
if let [Inst::Bitcast(..), _] = try_rev_take(2)?[..] {
3452-
try_rev_take(4)?;
3453-
}
3415+
let (rt_args_slice_ptr_id, _fmt_placeholders_slice_ptr_id) =
3416+
match prepare_args_insts[..] {
3417+
[
3418+
// HACK(eddyb) `rt::UnsafeArg::new()` call
3419+
// (`unsafe` ZST "constructor").
3420+
Inst::Call(_, _, ref rt_unsafe_arg_call_args),
3421+
Inst::Bitcast(
3422+
rt_args_cast_out_id,
3423+
rt_args_cast_in_id,
3424+
),
3425+
Inst::Bitcast(
3426+
placeholders_cast_out_id,
3427+
placeholders_cast_in_id,
3428+
),
3429+
] if rt_unsafe_arg_call_args.is_empty()
3430+
&& rt_args_cast_out_id == rt_args_slice_ptr_id
3431+
&& placeholders_cast_out_id
3432+
== fmt_placeholders_slice_ptr_id =>
3433+
{
3434+
(rt_args_cast_in_id, placeholders_cast_in_id)
34543435
}
3455-
Some(())
3456-
})
3457-
.ok_or_else(|| {
3458-
FormatArgsNotRecognized(
3459-
"fmt::rt::Placeholder::new call: ran out of instructions"
3460-
.into(),
3461-
)
3462-
})?;
3463-
}
3436+
_ => {
3437+
let mut insts = prepare_args_insts;
3438+
insts.extend(fmt_args_new_call_insts);
3439+
return Err(FormatArgsNotRecognized(format!(
3440+
"fmt::Arguments::new_v1_formatted call sequence ({insts:?})",
3441+
)));
3442+
}
3443+
};
34643444

34653445
decoded_format_args
34663446
.has_unknown_fmt_placeholder_to_args_mapping =
@@ -3749,7 +3729,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
37493729
let force_warn = |span, msg| -> rustc_errors::Diag<'_, ()> {
37503730
rustc_errors::Diag::new(
37513731
self.tcx.dcx(),
3752-
rustc_errors::Level::ForceWarning(None),
3732+
rustc_errors::Level::ForceWarning,
37533733
msg,
37543734
)
37553735
.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)