Skip to content

Commit 35a177e

Browse files
committed
---
yaml --- r: 47067 b: refs/heads/try c: d009c63 h: refs/heads/master i: 47065: ffb127d 47063: 32339d8 v: v3
1 parent c8798fd commit 35a177e

File tree

7 files changed

+203
-155
lines changed

7 files changed

+203
-155
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 3bbcac322669cff3abde5be937cc4ec3860f3985
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d9689399d091c3265f00434a69c551a61c28dc
5-
refs/heads/try: 6956e81c9bda11ec480e63b217efd44b83974fd3
5+
refs/heads/try: d009c6330b7d034889b0d720c7abbf940945d885
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libcore/vec.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1865,7 +1865,6 @@ pub trait OwnedVector<T> {
18651865
fn consume(self, f: fn(uint, v: T));
18661866
fn filter(self, f: fn(t: &T) -> bool) -> ~[T];
18671867
fn partition(self, f: pure fn(&T) -> bool) -> (~[T], ~[T]);
1868-
fn grow_fn(&mut self, n: uint, op: iter::InitOp<T>);
18691868
}
18701869

18711870
impl<T> OwnedVector<T> for ~[T] {
@@ -1937,11 +1936,6 @@ impl<T> OwnedVector<T> for ~[T] {
19371936
fn partition(self, f: fn(&T) -> bool) -> (~[T], ~[T]) {
19381937
partition(self, f)
19391938
}
1940-
1941-
#[inline]
1942-
fn grow_fn(&mut self, n: uint, op: iter::InitOp<T>) {
1943-
grow_fn(self, n, op);
1944-
}
19451939
}
19461940

19471941
impl<T> Mutable for ~[T] {
@@ -1952,6 +1946,7 @@ impl<T> Mutable for ~[T] {
19521946
pub trait OwnedCopyableVector<T: Copy> {
19531947
fn push_all(&mut self, rhs: &[const T]);
19541948
fn grow(&mut self, n: uint, initval: &T);
1949+
fn grow_fn(&mut self, n: uint, op: iter::InitOp<T>);
19551950
fn grow_set(&mut self, index: uint, initval: &T, val: T);
19561951
}
19571952

@@ -1966,6 +1961,11 @@ impl<T: Copy> OwnedCopyableVector<T> for ~[T] {
19661961
grow(self, n, initval);
19671962
}
19681963

1964+
#[inline]
1965+
fn grow_fn(&mut self, n: uint, op: iter::InitOp<T>) {
1966+
grow_fn(self, n, op);
1967+
}
1968+
19691969
#[inline]
19701970
fn grow_set(&mut self, index: uint, initval: &T, val: T) {
19711971
grow_set(self, index, initval, val);

branches/try/src/librustc/middle/trans/type_of.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,11 +328,20 @@ pub fn type_of(cx: @crate_ctxt, t: ty::t) -> TypeRef {
328328
pub fn enum_body_types(cx: @crate_ctxt, did: ast::def_id, t: ty::t)
329329
-> ~[TypeRef] {
330330
let univar = ty::enum_is_univariant(cx.tcx, did);
331-
let size = machine::static_size_of_enum(cx, t);
332331
if !univar {
332+
let size = machine::static_size_of_enum(cx, t);
333333
~[T_enum_discrim(cx), T_array(T_i8(), size)]
334-
} else {
335-
~[T_array(T_i8(), size)]
334+
}
335+
else {
336+
// Use the actual fields, so we get the alignment right.
337+
match ty::get(t).sty {
338+
ty::ty_enum(_, ref substs) => {
339+
do ty::enum_variants(cx.tcx, did)[0].args.map |&field_ty| {
340+
sizing_type_of(cx, ty::subst(cx.tcx, substs, field_ty))
341+
}
342+
}
343+
_ => cx.sess.bug(~"enum is not an enum")
344+
}
336345
}
337346
}
338347

0 commit comments

Comments
 (0)