Skip to content

Commit 19c3bbc

Browse files
klutzyalexcrichton
authored andcommitted
---
yaml --- r: 120285 b: refs/heads/dist-snap c: 9f7caed h: refs/heads/master i: 120283: 54e5561 v: v3
1 parent a00814d commit 19c3bbc

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
@@ -6,7 +6,7 @@ refs/heads/try: 1813e5aa1a03b0596b8de7abd1af31edf5d6098f
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 6878039c122211f227d6c42b7f08282629ceb6c4
9+
refs/heads/dist-snap: 9f7caed2024268f6de16f99b6696d191f3ca3228
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/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)

branches/dist-snap/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 {

branches/dist-snap/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+
}

branches/dist-snap/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)