Skip to content

Commit 4d22af4

Browse files
oisyneddyb
authored andcommitted
Compile fixes
1 parent 5c537e9 commit 4d22af4

File tree

3 files changed

+10
-16
lines changed

3 files changed

+10
-16
lines changed

crates/rustc_codegen_spirv/src/abi.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,14 +305,14 @@ impl<'tcx> ConvSpirvType<'tcx> for FnAbi<'tcx, Ty<'tcx>> {
305305
let return_type = match self.ret.mode {
306306
PassMode::Ignore => SpirvType::Void.def(span, cx),
307307
PassMode::Direct(_) | PassMode::Pair(..) => self.ret.layout.spirv_type(span, cx),
308-
PassMode::Cast(_) | PassMode::Indirect { .. } => span_bug!(
308+
PassMode::Cast(_, _) | PassMode::Indirect { .. } => span_bug!(
309309
span,
310310
"query hooks should've made this `PassMode` impossible: {:#?}",
311311
self.ret
312312
),
313313
};
314314

315-
for arg in &self.args {
315+
for arg in self.args.iter() {
316316
let arg_type = match arg.mode {
317317
PassMode::Ignore => continue,
318318
PassMode::Direct(_) => arg.layout.spirv_type(span, cx),
@@ -321,7 +321,7 @@ impl<'tcx> ConvSpirvType<'tcx> for FnAbi<'tcx, Ty<'tcx>> {
321321
argument_types.push(scalar_pair_element_backend_type(cx, span, arg.layout, 1));
322322
continue;
323323
}
324-
PassMode::Cast(_) | PassMode::Indirect { .. } => span_bug!(
324+
PassMode::Cast(_, _) | PassMode::Indirect { .. } => span_bug!(
325325
span,
326326
"query hooks should've made this `PassMode` impossible: {:#?}",
327327
arg

crates/rustc_codegen_spirv/src/builder/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ impl<'a, 'tcx> ArgAbiMethods<'tcx> for Builder<'a, 'tcx> {
331331
PassMode::Pair(..) => {
332332
OperandValue::Pair(next(self, idx), next(self, idx)).store(self, dst);
333333
}
334-
PassMode::Cast(_) | PassMode::Indirect { .. } => span_bug!(
334+
PassMode::Cast(_, _) | PassMode::Indirect { .. } => span_bug!(
335335
self.span(),
336336
"query hooks should've made this `PassMode` impossible: {:#?}",
337337
arg_abi
@@ -350,7 +350,7 @@ impl<'a, 'tcx> ArgAbiMethods<'tcx> for Builder<'a, 'tcx> {
350350
PassMode::Direct(_) | PassMode::Pair(..) => {
351351
OperandValue::Immediate(val).store(self, dst);
352352
}
353-
PassMode::Cast(_) | PassMode::Indirect { .. } => span_bug!(
353+
PassMode::Cast(_, _) | PassMode::Indirect { .. } => span_bug!(
354354
self.span(),
355355
"query hooks should've made this `PassMode` impossible: {:#?}",
356356
arg_abi

crates/rustc_codegen_spirv/src/codegen_cx/constant.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ use rspirv::spirv::Word;
66
use rustc_codegen_ssa::mir::place::PlaceRef;
77
use rustc_codegen_ssa::traits::{BaseTypeMethods, ConstMethods, MiscMethods, StaticMethods};
88
use rustc_middle::bug;
9-
use rustc_middle::mir::interpret::{
10-
alloc_range, ConstAllocation, GlobalAlloc, Scalar, ScalarMaybeUninit,
11-
};
9+
use rustc_middle::mir::interpret::{alloc_range, ConstAllocation, GlobalAlloc, Scalar};
1210
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
1311
use rustc_span::{Span, DUMMY_SP};
1412
use rustc_target::abi::{self, AddressSpace, HasDataLayout, Integer, Primitive, Size};
@@ -458,16 +456,12 @@ impl<'tcx> CodegenCx<'tcx> {
458456
// only uses the input alloc_id in the case that the scalar is uninitilized
459457
// as part of the error output
460458
// tldr, the pointer here is only needed for the offset
461-
let value = match alloc
459+
let scalar = alloc
462460
.inner()
463461
.read_scalar(self, alloc_range(*offset, size), primitive.is_ptr())
464-
.unwrap()
465-
{
466-
ScalarMaybeUninit::Scalar(scalar) => {
467-
self.scalar_to_backend(scalar, self.primitive_to_scalar(primitive), ty)
468-
}
469-
ScalarMaybeUninit::Uninit => self.undef(ty),
470-
};
462+
.unwrap();
463+
let value = self.scalar_to_backend(scalar, self.primitive_to_scalar(primitive), ty);
464+
471465
*offset += size;
472466
value
473467
}

0 commit comments

Comments
 (0)