Compile fixes

This commit is contained in:
Sylvester Hesp 2022-09-21 10:43:50 +02:00 committed by Eduard-Mihai Burtescu
parent 5c537e9e4c
commit 4d22af493f
3 changed files with 10 additions and 16 deletions

View File

@ -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

View File

@ -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

View File

@ -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
}