aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2010-11-22 14:28:05 -0800
committerGraydon Hoare <[email protected]>2010-11-22 14:28:05 -0800
commitc262543d3b353c46611059b70ee7ee3771b5df14 (patch)
tree98a5ee6de931bfe633b4b3a4f719d0c3d42b2b15 /src
parentCheck for structural equality rather than structural-and-cname equality. (diff)
downloadrust-c262543d3b353c46611059b70ee7ee3771b5df14.tar.xz
rust-c262543d3b353c46611059b70ee7ee3771b5df14.zip
Fix type disagreements in lowering typeck.ty to llvm TypeRefs, enable complex.rs test.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile1
-rw-r--r--src/comp/middle/trans.rs20
2 files changed, 11 insertions, 10 deletions
diff --git a/src/Makefile b/src/Makefile
index a0c08f0d..9a4d1383 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -522,6 +522,7 @@ TEST_XFAILS_SELF := $(filter-out \
arith-2.rs \
bool-not.rs \
char.rs \
+ complex.rs \
dead-code-one-arm-if.rs \
deep.rs \
div-mod.rs \
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index 5255379d..6b45ad85 100644
--- a/src/comp/middle/trans.rs
+++ b/src/comp/middle/trans.rs
@@ -196,16 +196,16 @@ fn T_array(TypeRef t, uint n) -> TypeRef {
ret llvm.LLVMArrayType(t, n);
}
-fn T_vec(TypeRef t, uint n) -> TypeRef {
- ret T_struct(vec(T_int(), // Refcount
- T_int(), // Alloc
- T_int(), // Fill
- T_array(t, n) // Body elements
+fn T_vec(TypeRef t) -> TypeRef {
+ ret T_struct(vec(T_int(), // Refcount
+ T_int(), // Alloc
+ T_int(), // Fill
+ T_array(t, 0u) // Body elements
));
}
-fn T_str(uint n) -> TypeRef {
- ret T_vec(T_i8(), n);
+fn T_str() -> TypeRef {
+ ret T_vec(T_i8());
}
fn T_box(TypeRef t) -> TypeRef {
@@ -265,12 +265,12 @@ fn type_of_inner(@crate_ctxt cx, @typeck.ty t) -> TypeRef {
}
}
case (typeck.ty_char) { ret T_char(); }
- case (typeck.ty_str) { ret T_str(0u); }
+ case (typeck.ty_str) { ret T_ptr(T_str()); }
case (typeck.ty_box(?t)) {
ret T_ptr(T_box(type_of(cx, t)));
}
case (typeck.ty_vec(?t)) {
- ret T_ptr(T_vec(type_of(cx, t), 0u));
+ ret T_ptr(T_vec(type_of(cx, t)));
}
case (typeck.ty_tup(?elts)) {
let vec[TypeRef] tys = vec();
@@ -544,7 +544,7 @@ impure fn trans_lit(@block_ctxt cx, &ast.lit lit) -> result {
vec(p2i(C_str(cx.fcx.ccx, s)),
C_int(len)));
sub.val = sub.bcx.build.IntToPtr(sub.val,
- T_ptr(T_str(len as uint)));
+ T_ptr(T_str()));
cx.cleanups += vec(clean(bind trans_drop_str(_, sub.val)));
ret sub;
}