Skip to content

Commit 1d94a20

Browse files
committed
Make int_width only operate on ints
1 parent 6df72e4 commit 1d94a20

File tree

1 file changed

+4
-1
lines changed
  • crates/rustc_codegen_nvvm/src

1 file changed

+4
-1
lines changed

crates/rustc_codegen_nvvm/src/ty.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,10 @@ impl<'ll, 'tcx> BaseTypeCodegenMethods for CodegenCx<'ll, 'tcx> {
237237
}
238238

239239
fn int_width(&self, ty: &'ll Type) -> u64 {
240-
unsafe { llvm::LLVMGetIntTypeWidth(ty) as u64 }
240+
match self.type_kind(ty) {
241+
TypeKind::Integer => unsafe { llvm::LLVMGetIntTypeWidth(ty) as u64 },
242+
_ => bug!("llvm_int_width called on a non-integer type"),
243+
}
241244
}
242245

243246
fn val_ty(&self, v: &'ll Value) -> &'ll Type {

0 commit comments

Comments
 (0)