Skip to content

Commit 7a1cd11

Browse files
committed
---
yaml --- r: 52731 b: refs/heads/dist-snap c: 7b268e8 h: refs/heads/master i: 52729: 367d126 52727: 76b2d61 v: v3
1 parent 3607c39 commit 7a1cd11

File tree

3 files changed

+29
-30
lines changed

3 files changed

+29
-30
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: 44d4d6de762f3f9aae1fedcf454c66b79b3ad58d
10-
refs/heads/dist-snap: 0d1058a62e728f0dfed04fe93cc38dcf6be38f0b
10+
refs/heads/dist-snap: 7b268e83167a9dc914dfea9ec4d0448cce8ee6e2
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/libcore/vec.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -541,10 +541,8 @@ pub fn remove<T>(v: &mut ~[T], i: uint) -> T {
541541
v.pop()
542542
}
543543

544-
pub fn consume<T>(v: ~[T], f: fn(uint, v: T)) {
544+
pub fn consume<T>(mut v: ~[T], f: fn(uint, v: T)) {
545545
unsafe {
546-
let mut v = v; // FIXME(#3488)
547-
548546
do as_mut_buf(v) |p, ln| {
549547
for uint::range(0, ln) |i| {
550548
// NB: This unsafe operation counts on init writing 0s to the
@@ -641,8 +639,7 @@ pub fn push_all<T: Copy>(v: &mut ~[T], rhs: &[const T]) {
641639
}
642640

643641
#[inline(always)]
644-
pub fn push_all_move<T>(v: &mut ~[T], rhs: ~[T]) {
645-
let mut rhs = rhs; // FIXME(#3488)
642+
pub fn push_all_move<T>(v: &mut ~[T], mut rhs: ~[T]) {
646643
reserve(&mut *v, v.len() + rhs.len());
647644
unsafe {
648645
do as_mut_buf(rhs) |p, len| {
@@ -1241,8 +1238,7 @@ pub pure fn zip_slice<T: Copy, U: Copy>(v: &[const T], u: &[const U])
12411238
* Returns a vector of tuples, where the i-th tuple contains contains the
12421239
* i-th elements from each of the input vectors.
12431240
*/
1244-
pub pure fn zip<T, U>(v: ~[T], u: ~[U]) -> ~[(T, U)] {
1245-
let mut v = v, u = u; // FIXME(#3488)
1241+
pub pure fn zip<T, U>(mut v: ~[T], mut u: ~[U]) -> ~[(T, U)] {
12461242
let mut i = len(v);
12471243
assert i == len(u);
12481244
let mut w = with_capacity(i);

branches/dist-snap/src/librustc/middle/trans/base.rs

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1986,7 +1986,7 @@ pub fn trans_struct_dtor(ccx: @crate_ctxt,
19861986
}
19871987

19881988
pub fn trans_enum_def(ccx: @crate_ctxt, enum_definition: ast::enum_def,
1989-
id: ast::node_id, degen: bool,
1989+
id: ast::node_id, tps: ~[ast::ty_param], degen: bool,
19901990
path: @ast_map::path, vi: @~[ty::VariantInfo],
19911991
i: &mut uint) {
19921992
for vec::each(enum_definition.variants) |variant| {
@@ -2003,13 +2003,14 @@ pub fn trans_enum_def(ccx: @crate_ctxt, enum_definition: ast::enum_def,
20032003
// Nothing to do.
20042004
}
20052005
ast::struct_variant_kind(struct_def) => {
2006-
trans_struct_def(ccx, struct_def, path,
2006+
trans_struct_def(ccx, struct_def, /*bad*/copy tps, path,
20072007
variant.node.id);
20082008
}
20092009
ast::enum_variant_kind(ref enum_definition) => {
20102010
trans_enum_def(ccx,
20112011
*enum_definition,
20122012
id,
2013+
/*bad*/copy tps,
20132014
degen,
20142015
path,
20152016
vi,
@@ -2061,11 +2062,11 @@ pub fn trans_item(ccx: @crate_ctxt, item: ast::item) {
20612062
trans_mod(ccx, m);
20622063
}
20632064
ast::item_enum(ref enum_definition, ref tps) => {
2064-
if tps.is_empty() {
2065+
if tps.len() == 0u {
20652066
let degen = (*enum_definition).variants.len() == 1u;
20662067
let vi = ty::enum_variants(ccx.tcx, local_def(item.id));
20672068
let mut i = 0;
2068-
trans_enum_def(ccx, (*enum_definition), item.id,
2069+
trans_enum_def(ccx, (*enum_definition), item.id, /*bad*/copy *tps,
20692070
degen, path, vi, &mut i);
20702071
}
20712072
}
@@ -2079,33 +2080,35 @@ pub fn trans_item(ccx: @crate_ctxt, item: ast::item) {
20792080
foreign::trans_foreign_mod(ccx, foreign_mod, abi);
20802081
}
20812082
ast::item_struct(struct_def, tps) => {
2082-
if tps.is_empty() {
2083-
trans_struct_def(ccx, struct_def, path, item.id);
2084-
}
2083+
trans_struct_def(ccx, struct_def, tps, path, item.id);
20852084
}
20862085
_ => {/* fall through */ }
20872086
}
20882087
}
20892088

20902089
pub fn trans_struct_def(ccx: @crate_ctxt, struct_def: @ast::struct_def,
2091-
path: @ast_map::path,
2090+
tps: ~[ast::ty_param], path: @ast_map::path,
20922091
id: ast::node_id) {
2093-
// Translate the destructor.
2094-
do option::iter(&struct_def.dtor) |dtor| {
2095-
trans_struct_dtor(ccx, /*bad*/copy *path, dtor.node.body,
2096-
dtor.node.id, None, None, local_def(id));
2097-
};
2092+
// If there are type parameters, the destructor and constructor will be
2093+
// monomorphized, so we don't translate them here.
2094+
if tps.len() == 0u {
2095+
// Translate the destructor.
2096+
do option::iter(&struct_def.dtor) |dtor| {
2097+
trans_struct_dtor(ccx, /*bad*/copy *path, dtor.node.body,
2098+
dtor.node.id, None, None, local_def(id));
2099+
};
20982100

2099-
// If this is a tuple-like struct, translate the constructor.
2100-
match struct_def.ctor_id {
2101-
// We only need to translate a constructor if there are fields;
2102-
// otherwise this is a unit-like struct.
2103-
Some(ctor_id) if struct_def.fields.len() > 0 => {
2104-
let llfndecl = get_item_val(ccx, ctor_id);
2105-
trans_tuple_struct(ccx, /*bad*/copy struct_def.fields,
2106-
ctor_id, None, llfndecl);
2101+
// If this is a tuple-like struct, translate the constructor.
2102+
match struct_def.ctor_id {
2103+
// We only need to translate a constructor if there are fields;
2104+
// otherwise this is a unit-like struct.
2105+
Some(ctor_id) if struct_def.fields.len() > 0 => {
2106+
let llfndecl = get_item_val(ccx, ctor_id);
2107+
trans_tuple_struct(ccx, /*bad*/copy struct_def.fields,
2108+
ctor_id, None, llfndecl);
2109+
}
2110+
Some(_) | None => {}
21072111
}
2108-
Some(_) | None => {}
21092112
}
21102113
}
21112114

0 commit comments

Comments
 (0)