From 4d22af493f2675f41282837c7e9a6f371391c0b8 Mon Sep 17 00:00:00 2001 From: Sylvester Hesp Date: Wed, 21 Sep 2022 10:43:50 +0200 Subject: [PATCH] Compile fixes --- crates/rustc_codegen_spirv/src/abi.rs | 6 +++--- crates/rustc_codegen_spirv/src/builder/mod.rs | 4 ++-- .../src/codegen_cx/constant.rs | 16 +++++----------- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/crates/rustc_codegen_spirv/src/abi.rs b/crates/rustc_codegen_spirv/src/abi.rs index a23e655581..bd0c4e3a58 100644 --- a/crates/rustc_codegen_spirv/src/abi.rs +++ b/crates/rustc_codegen_spirv/src/abi.rs @@ -305,14 +305,14 @@ impl<'tcx> ConvSpirvType<'tcx> for FnAbi<'tcx, Ty<'tcx>> { let return_type = match self.ret.mode { PassMode::Ignore => SpirvType::Void.def(span, cx), PassMode::Direct(_) | PassMode::Pair(..) => self.ret.layout.spirv_type(span, cx), - PassMode::Cast(_) | PassMode::Indirect { .. } => span_bug!( + PassMode::Cast(_, _) | PassMode::Indirect { .. } => span_bug!( span, "query hooks should've made this `PassMode` impossible: {:#?}", self.ret ), }; - for arg in &self.args { + for arg in self.args.iter() { let arg_type = match arg.mode { PassMode::Ignore => continue, PassMode::Direct(_) => arg.layout.spirv_type(span, cx), @@ -321,7 +321,7 @@ impl<'tcx> ConvSpirvType<'tcx> for FnAbi<'tcx, Ty<'tcx>> { argument_types.push(scalar_pair_element_backend_type(cx, span, arg.layout, 1)); continue; } - PassMode::Cast(_) | PassMode::Indirect { .. } => span_bug!( + PassMode::Cast(_, _) | PassMode::Indirect { .. } => span_bug!( span, "query hooks should've made this `PassMode` impossible: {:#?}", arg diff --git a/crates/rustc_codegen_spirv/src/builder/mod.rs b/crates/rustc_codegen_spirv/src/builder/mod.rs index 7f86745066..a4fb651aff 100644 --- a/crates/rustc_codegen_spirv/src/builder/mod.rs +++ b/crates/rustc_codegen_spirv/src/builder/mod.rs @@ -331,7 +331,7 @@ impl<'a, 'tcx> ArgAbiMethods<'tcx> for Builder<'a, 'tcx> { PassMode::Pair(..) => { OperandValue::Pair(next(self, idx), next(self, idx)).store(self, dst); } - PassMode::Cast(_) | PassMode::Indirect { .. } => span_bug!( + PassMode::Cast(_, _) | PassMode::Indirect { .. } => span_bug!( self.span(), "query hooks should've made this `PassMode` impossible: {:#?}", arg_abi @@ -350,7 +350,7 @@ impl<'a, 'tcx> ArgAbiMethods<'tcx> for Builder<'a, 'tcx> { PassMode::Direct(_) | PassMode::Pair(..) => { OperandValue::Immediate(val).store(self, dst); } - PassMode::Cast(_) | PassMode::Indirect { .. } => span_bug!( + PassMode::Cast(_, _) | PassMode::Indirect { .. } => span_bug!( self.span(), "query hooks should've made this `PassMode` impossible: {:#?}", arg_abi diff --git a/crates/rustc_codegen_spirv/src/codegen_cx/constant.rs b/crates/rustc_codegen_spirv/src/codegen_cx/constant.rs index 640d3ec5db..a80ecbd661 100644 --- a/crates/rustc_codegen_spirv/src/codegen_cx/constant.rs +++ b/crates/rustc_codegen_spirv/src/codegen_cx/constant.rs @@ -6,9 +6,7 @@ use rspirv::spirv::Word; use rustc_codegen_ssa::mir::place::PlaceRef; use rustc_codegen_ssa::traits::{BaseTypeMethods, ConstMethods, MiscMethods, StaticMethods}; use rustc_middle::bug; -use rustc_middle::mir::interpret::{ - alloc_range, ConstAllocation, GlobalAlloc, Scalar, ScalarMaybeUninit, -}; +use rustc_middle::mir::interpret::{alloc_range, ConstAllocation, GlobalAlloc, Scalar}; use rustc_middle::ty::layout::{LayoutOf, TyAndLayout}; use rustc_span::{Span, DUMMY_SP}; use rustc_target::abi::{self, AddressSpace, HasDataLayout, Integer, Primitive, Size}; @@ -458,16 +456,12 @@ impl<'tcx> CodegenCx<'tcx> { // only uses the input alloc_id in the case that the scalar is uninitilized // as part of the error output // tldr, the pointer here is only needed for the offset - let value = match alloc + let scalar = alloc .inner() .read_scalar(self, alloc_range(*offset, size), primitive.is_ptr()) - .unwrap() - { - ScalarMaybeUninit::Scalar(scalar) => { - self.scalar_to_backend(scalar, self.primitive_to_scalar(primitive), ty) - } - ScalarMaybeUninit::Uninit => self.undef(ty), - }; + .unwrap(); + let value = self.scalar_to_backend(scalar, self.primitive_to_scalar(primitive), ty); + *offset += size; value }