pub fn LLVMIsPackedStruct(StructTy: TypeRef) -> Bool;
/* Operations on array, pointer, and vector types (sequence types) */
- pub fn LLVMArrayType(ElementType: TypeRef, ElementCount: c_uint)
- -> TypeRef;
+ pub fn LLVMRustArrayType(ElementType: TypeRef, ElementCount: u64) -> TypeRef;
pub fn LLVMPointerType(ElementType: TypeRef, AddressSpace: c_uint)
-> TypeRef;
pub fn LLVMVectorType(ElementType: TypeRef, ElementCount: c_uint)
}
pub fn array(ty: &Type, len: u64) -> Type {
- ty!(llvm::LLVMArrayType(ty.to_ref(), len as c_uint))
+ ty!(llvm::LLVMRustArrayType(ty.to_ref(), len))
}
pub fn vector(ty: &Type, len: u64) -> Type {
*ptr = ret.data();
return ret.size();
}
+
+// LLVMArrayType function does not support 64-bit ElementCount
+extern "C" LLVMTypeRef
+LLVMRustArrayType(LLVMTypeRef ElementType, uint64_t ElementCount) {
+ return wrap(ArrayType::get(unwrap(ElementType), ElementCount));
+}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+use std::mem::size_of;
+
pub fn main() {
let x: [int, ..4] = [1, 2, 3, 4];
- println!("{}", x[0]);
+ assert_eq!(x[0], 1);
+ assert_eq!(x[1], 2);
+ assert_eq!(x[2], 3);
+ assert_eq!(x[3], 4);
+
+ assert_eq!(size_of::<[u8, ..4]>(), 4u);
+
+ // FIXME #10183
+ if cfg!(target_word_size = "64") {
+ assert_eq!(size_of::<[u8, ..(1 << 32)]>(), (1u << 32));
+ }
}