Skip to content

Commit 33e8d4c

Browse files
committed
fix cranelift and gcc backends
1 parent 4587677 commit 33e8d4c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/common.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use rustc_codegen_ssa::traits::{
99
StaticMethods,
1010
};
1111
use rustc_middle::mir::Mutability;
12-
use rustc_middle::ty::ScalarInt;
1312
use rustc_middle::ty::layout::{TyAndLayout, LayoutOf};
1413
use rustc_middle::mir::interpret::{ConstAllocation, GlobalAlloc, Scalar};
1514
use rustc_target::abi::{self, HasDataLayout, Pointer, Size};
@@ -159,13 +158,13 @@ impl<'gcc, 'tcx> ConstMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
159158
None
160159
}
161160

161+
fn zst_to_backend(&self, _ty: Type<'gcc>) -> RValue<'gcc> {
162+
self.const_undef(self.type_ix(0))
163+
}
164+
162165
fn scalar_to_backend(&self, cv: Scalar, layout: abi::Scalar, ty: Type<'gcc>) -> RValue<'gcc> {
163166
let bitsize = if layout.is_bool() { 1 } else { layout.size(self).bits() };
164167
match cv {
165-
Scalar::Int(ScalarInt::ZST) => {
166-
assert_eq!(0, layout.size(self).bytes());
167-
self.const_undef(self.type_ix(0))
168-
}
169168
Scalar::Int(int) => {
170169
let data = int.assert_bits(layout.size(self));
171170

0 commit comments

Comments
 (0)