Skip to content

Commit 1ecd75e

Browse files
klutzyalexcrichton
authored andcommitted
---
yaml --- r: 114103 b: refs/heads/master c: 9f7caed h: refs/heads/master i: 114101: 00c029d 114099: 7f70ab7 114095: 7cc842c v: v3
1 parent 434f72c commit 1ecd75e

File tree

5 files changed

+22
-5
lines changed

5 files changed

+22
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 6878039c122211f227d6c42b7f08282629ceb6c4
2+
refs/heads/master: 9f7caed2024268f6de16f99b6696d191f3ca3228
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: ec0258a381b88b5574e3f8ce72ae553ac3a574b7
55
refs/heads/try: 7c6c492fb2af9a85f21ff952942df3523b22fd17

trunk/src/librustc/lib/llvm.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,7 @@ pub mod llvm {
398398
pub fn LLVMIsPackedStruct(StructTy: TypeRef) -> Bool;
399399

400400
/* Operations on array, pointer, and vector types (sequence types) */
401-
pub fn LLVMArrayType(ElementType: TypeRef, ElementCount: c_uint)
402-
-> TypeRef;
401+
pub fn LLVMRustArrayType(ElementType: TypeRef, ElementCount: u64) -> TypeRef;
403402
pub fn LLVMPointerType(ElementType: TypeRef, AddressSpace: c_uint)
404403
-> TypeRef;
405404
pub fn LLVMVectorType(ElementType: TypeRef, ElementCount: c_uint)

trunk/src/librustc/middle/trans/type_.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ impl Type {
207207
}
208208

209209
pub fn array(ty: &Type, len: u64) -> Type {
210-
ty!(llvm::LLVMArrayType(ty.to_ref(), len as c_uint))
210+
ty!(llvm::LLVMRustArrayType(ty.to_ref(), len))
211211
}
212212

213213
pub fn vector(ty: &Type, len: u64) -> Type {

trunk/src/rustllvm/RustWrapper.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,3 +754,9 @@ LLVMRustGetSectionName(LLVMSectionIteratorRef SI, const char **ptr) {
754754
*ptr = ret.data();
755755
return ret.size();
756756
}
757+
758+
// LLVMArrayType function does not support 64-bit ElementCount
759+
extern "C" LLVMTypeRef
760+
LLVMRustArrayType(LLVMTypeRef ElementType, uint64_t ElementCount) {
761+
return wrap(ArrayType::get(unwrap(ElementType), ElementCount));
762+
}

trunk/src/test/run-pass/vec-fixed-length.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,19 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
use std::mem::size_of;
12+
1113
pub fn main() {
1214
let x: [int, ..4] = [1, 2, 3, 4];
13-
println!("{}", x[0]);
15+
assert_eq!(x[0], 1);
16+
assert_eq!(x[1], 2);
17+
assert_eq!(x[2], 3);
18+
assert_eq!(x[3], 4);
19+
20+
assert_eq!(size_of::<[u8, ..4]>(), 4u);
21+
22+
// FIXME #10183
23+
if cfg!(target_word_size = "64") {
24+
assert_eq!(size_of::<[u8, ..(1 << 32)]>(), (1u << 32));
25+
}
1426
}

0 commit comments

Comments
 (0)