Skip to content

Commit cc75231

Browse files
eddybLegNeato
authored andcommitted
rustup: update to nightly-2024-03-01.
1 parent 2dc6146 commit cc75231

28 files changed

+64
-67
lines changed

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/rustc_codegen_spirv/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ use std::process::{Command, ExitCode};
1010
/// `cargo publish`. We need to figure out a way to do this properly, but let's hardcode it for now :/
1111
//const REQUIRED_RUST_TOOLCHAIN: &str = include_str!("../../rust-toolchain.toml");
1212
const REQUIRED_RUST_TOOLCHAIN: &str = r#"[toolchain]
13-
channel = "nightly-2024-02-01"
13+
channel = "nightly-2024-03-01"
1414
components = ["rust-src", "rustc-dev", "llvm-tools"]
15-
# commit_hash = 11f32b73e0dc9287e305b5b9980d24aecdc8c17f"#;
15+
# commit_hash = 878c8a2a62d49ca5c454547ad67290a1df746cb5"#;
1616

1717
fn get_rustc_commit_hash() -> Result<String, Box<dyn Error>> {
1818
let rustc = std::env::var("RUSTC").unwrap_or_else(|_| String::from("rustc"));

crates/rustc_codegen_spirv/src/attr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ impl CheckSpirvAttrVisitor<'_> {
317317
| SpirvAttribute::InputAttachmentIndex(_)
318318
| SpirvAttribute::SpecConstant(_) => match target {
319319
Target::Param => {
320-
let parent_hir_id = self.tcx.hir().parent_id(hir_id);
320+
let parent_hir_id = self.tcx.parent_hir_id(hir_id);
321321
let parent_is_entry_point =
322322
parse_attrs(self.tcx.hir().attrs(parent_hir_id))
323323
.filter_map(|r| r.ok())

crates/rustc_codegen_spirv/src/builder/builder_methods.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ use rustc_target::abi::{Abi, Align, Scalar, Size, WrappingRange};
2828
use smallvec::SmallVec;
2929
use std::borrow::Cow;
3030
use std::cell::Cell;
31-
use std::convert::TryInto;
3231
use std::iter::{self, empty};
3332
use std::ops::RangeInclusive;
3433

@@ -1193,11 +1192,14 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
11931192
int(a, b) => a.wrapping_add(b)
11941193
}
11951194
}
1195+
// FIXME(eddyb) try to annotate the SPIR-V for `fast` and `algebraic`.
11961196
simple_op! {fadd, f_add}
11971197
simple_op! {fadd_fast, f_add} // fast=normal
1198+
simple_op! {fadd_algebraic, f_add} // algebraic=normal
11981199
simple_op! {sub, i_sub}
11991200
simple_op! {fsub, f_sub}
12001201
simple_op! {fsub_fast, f_sub} // fast=normal
1202+
simple_op! {fsub_algebraic, f_sub} // algebraic=normal
12011203
simple_op! {
12021204
mul, i_mul,
12031205
// HACK(eddyb) `rustc_codegen_ssa` relies on `Builder` methods doing
@@ -1208,6 +1210,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
12081210
}
12091211
simple_op! {fmul, f_mul}
12101212
simple_op! {fmul_fast, f_mul} // fast=normal
1213+
simple_op! {fmul_algebraic, f_mul} // algebraic=normal
12111214
simple_op! {udiv, u_div}
12121215
// Note: exactudiv is UB when there's a remainder, so it's valid to implement as a normal div.
12131216
// TODO: Can we take advantage of the UB and emit something else?
@@ -1217,10 +1220,12 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
12171220
simple_op! {exactsdiv, s_div}
12181221
simple_op! {fdiv, f_div}
12191222
simple_op! {fdiv_fast, f_div} // fast=normal
1223+
simple_op! {fdiv_algebraic, f_div} // algebraic=normal
12201224
simple_op! {urem, u_mod}
12211225
simple_op! {srem, s_rem}
12221226
simple_op! {frem, f_rem}
12231227
simple_op! {frem_fast, f_rem} // fast=normal
1228+
simple_op! {frem_algebraic, f_rem} // algebraic=normal
12241229
simple_op_unchecked_type! {shl, shift_left_logical}
12251230
simple_op_unchecked_type! {lshr, shift_right_logical}
12261231
simple_op_unchecked_type! {ashr, shift_right_arithmetic}

crates/rustc_codegen_spirv/src/builder/intrinsics.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ use rspirv::spirv::GLOp;
99
use rustc_codegen_ssa::mir::operand::OperandRef;
1010
use rustc_codegen_ssa::mir::place::PlaceRef;
1111
use rustc_codegen_ssa::traits::{BuilderMethods, IntrinsicCallMethods};
12-
use rustc_middle::bug;
1312
use rustc_middle::ty::layout::LayoutOf;
1413
use rustc_middle::ty::{FnDef, Instance, ParamEnv, Ty, TyKind};
14+
use rustc_middle::{bug, ty};
1515
use rustc_span::sym;
1616
use rustc_span::Span;
1717
use rustc_target::abi::call::{FnAbi, PassMode};
@@ -71,7 +71,7 @@ impl<'a, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'tcx> {
7171
args: &[OperandRef<'tcx, Self::Value>],
7272
llresult: Self::Value,
7373
_span: Span,
74-
) {
74+
) -> Result<(), ty::Instance<'tcx>> {
7575
let callee_ty = instance.ty(self.tcx, ParamEnv::reveal_all());
7676

7777
let (def_id, fn_args) = match *callee_ty.kind() {
@@ -98,7 +98,7 @@ impl<'a, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'tcx> {
9898
sym::breakpoint => {
9999
self.abort();
100100
assert!(fn_abi.ret.is_ignore());
101-
return;
101+
return Ok(());
102102
}
103103

104104
sym::volatile_load | sym::unaligned_volatile_load => {
@@ -108,7 +108,7 @@ impl<'a, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'tcx> {
108108
if !result.layout.is_zst() {
109109
self.store(load, result.llval, result.align);
110110
}
111-
return;
111+
return Ok(());
112112
}
113113

114114
sym::prefetch_read_data
@@ -117,7 +117,7 @@ impl<'a, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'tcx> {
117117
| sym::prefetch_write_instruction => {
118118
// ignore
119119
assert!(fn_abi.ret.is_ignore());
120-
return;
120+
return Ok(());
121121
}
122122

123123
sym::saturating_add => {
@@ -336,7 +336,10 @@ impl<'a, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'tcx> {
336336
undef
337337
}
338338

339-
_ => self.fatal(format!("TODO: Unknown intrinsic '{name}'")),
339+
_ => {
340+
// Call the fallback body instead of generating the intrinsic code
341+
return Err(ty::Instance::new(instance.def_id(), instance.args));
342+
}
340343
};
341344

342345
if !fn_abi.ret.is_ignore() {
@@ -345,6 +348,7 @@ impl<'a, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'tcx> {
345348
.val
346349
.store(self, result);
347350
}
351+
Ok(())
348352
}
349353

350354
fn abort(&mut self) {

crates/rustc_codegen_spirv/src/builder/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use rustc_codegen_ssa::traits::{
2020
AbiBuilderMethods, ArgAbiMethods, BackendTypes, BuilderMethods, CoverageInfoBuilderMethods,
2121
DebugInfoBuilderMethods, HasCodegen, StaticBuilderMethods, TypeMembershipMethods,
2222
};
23-
use rustc_errors::{DiagnosticBuilder, DiagnosticMessage};
23+
use rustc_errors::{Diag, DiagnosticMessage};
2424
use rustc_middle::mir::Coverage;
2525
use rustc_middle::span_bug;
2626
use rustc_middle::ty::layout::{
@@ -69,7 +69,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
6969
}
7070

7171
#[track_caller]
72-
pub fn struct_err(&self, msg: impl Into<DiagnosticMessage>) -> DiagnosticBuilder<'_> {
72+
pub fn struct_err(&self, msg: impl Into<DiagnosticMessage>) -> Diag<'_> {
7373
if let Some(current_span) = self.current_span {
7474
self.tcx.dcx().struct_span_err(current_span, msg)
7575
} else {

crates/rustc_codegen_spirv/src/builder/spirv_asm.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet};
1515
use rustc_middle::{bug, ty::Instance};
1616
use rustc_span::{Span, DUMMY_SP};
1717
use rustc_target::asm::{InlineAsmRegClass, InlineAsmRegOrRegClass, SpirVInlineAsmRegClass};
18-
use std::convert::TryFrom;
1918

2019
pub struct InstructionTable {
2120
table: FxHashMap<&'static str, &'static rspirv::grammar::Instruction<'static>>,

crates/rustc_codegen_spirv/src/builder_spirv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub enum SpirvValueKind {
3737

3838
/// This can only happen in one specific case - which is as a result of
3939
/// `codegen_buffer_store_intrinsic`, that function is supposed to return
40-
/// OpTypeVoid, however because it gets inline by the compiler it can't.
40+
/// `OpTypeVoid`, however because it gets inline by the compiler it can't.
4141
/// Instead we return this, and trigger an error if we ever end up using the
4242
/// result of this function call (which we can't).
4343
IllegalTypeUsed(Word),

crates/rustc_codegen_spirv/src/codegen_cx/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ pub struct CodegenCx<'tcx> {
7070
/// "specifier" as a `char` (' ' for `Display`, `x` for `LowerHex`, etc.)
7171
pub fmt_rt_arg_new_fn_ids_to_ty_and_spec: RefCell<FxHashMap<Word, (Ty<'tcx>, char)>>,
7272

73-
/// Intrinsic for loading a <T> from a &[u32]. The PassMode is the mode of the <T>.
73+
/// Intrinsic for loading a `<T>` from a `&[u32]`. The `PassMode` is the mode of the `<T>`.
7474
pub buffer_load_intrinsic_fn_id: RefCell<FxHashMap<Word, &'tcx PassMode>>,
75-
/// Intrinsic for storing a <T> into a &[u32]. The PassMode is the mode of the <T>.
75+
/// Intrinsic for storing a `<T>` into a `&[u32]`. The `PassMode` is the mode of the `<T>`.
7676
pub buffer_store_intrinsic_fn_id: RefCell<FxHashMap<Word, &'tcx PassMode>>,
7777

7878
/// Some runtimes (e.g. intel-compute-runtime) disallow atomics on i8 and i16, even though it's allowed by the spec.

crates/rustc_codegen_spirv/src/lib.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -252,15 +252,11 @@ impl CodegenBackend for SpirvCodegenBackend {
252252
ongoing_codegen: Box<dyn Any>,
253253
sess: &Session,
254254
_outputs: &OutputFilenames,
255-
) -> Result<(CodegenResults, FxIndexMap<WorkProductId, WorkProduct>), ErrorGuaranteed> {
256-
let (codegen_results, work_products) = ongoing_codegen
255+
) -> (CodegenResults, FxIndexMap<WorkProductId, WorkProduct>) {
256+
ongoing_codegen
257257
.downcast::<OngoingCodegen<Self>>()
258258
.expect("Expected OngoingCodegen, found Box<Any>")
259-
.join(sess);
260-
261-
sess.compile_status()?;
262-
263-
Ok((codegen_results, work_products))
259+
.join(sess)
264260
}
265261

266262
fn link(
@@ -278,8 +274,7 @@ impl CodegenBackend for SpirvCodegenBackend {
278274
);
279275
drop(timer);
280276

281-
sess.compile_status()?;
282-
Ok(())
277+
sess.dcx().has_errors().map_or(Ok(()), Err)
283278
}
284279
}
285280

0 commit comments

Comments
 (0)