From 33e8d4c2d4adf4cf43cd423e45c35b6c9c17267b Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 5 Jul 2022 16:53:48 -0400 Subject: [PATCH] fix cranelift and gcc backends --- src/common.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/common.rs b/src/common.rs index d156f874434..fc391f53f18 100644 --- a/src/common.rs +++ b/src/common.rs @@ -9,7 +9,6 @@ StaticMethods, }; use rustc_middle::mir::Mutability; -use rustc_middle::ty::ScalarInt; use rustc_middle::ty::layout::{TyAndLayout, LayoutOf}; use rustc_middle::mir::interpret::{ConstAllocation, GlobalAlloc, Scalar}; use rustc_target::abi::{self, HasDataLayout, Pointer, Size}; @@ -159,13 +158,13 @@ fn const_to_opt_u128(&self, _v: RValue<'gcc>, _sign_ext: bool) -> Option { None } + fn zst_to_backend(&self, _ty: Type<'gcc>) -> RValue<'gcc> { + self.const_undef(self.type_ix(0)) + } + fn scalar_to_backend(&self, cv: Scalar, layout: abi::Scalar, ty: Type<'gcc>) -> RValue<'gcc> { let bitsize = if layout.is_bool() { 1 } else { layout.size(self).bits() }; match cv { - Scalar::Int(ScalarInt::ZST) => { - assert_eq!(0, layout.size(self).bytes()); - self.const_undef(self.type_ix(0)) - } Scalar::Int(int) => { let data = int.assert_bits(layout.size(self));