Skip to content

Commit f2001e2

Browse files
committed
---
yaml --- r: 24257 b: refs/heads/master c: 21519bc h: refs/heads/master i: 24255: 235abf4 v: v3
1 parent 812efd1 commit f2001e2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+542
-465
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: 6c15dd6d8217a166cfd0d364a434771803123432
2+
refs/heads/master: 21519bc7e0a32e388e8b12be5d36d4440129f417
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be

trunk/src/cargo/cargo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ fn load_one_source_package(src: @Source, p: &json::Object) {
527527
Some(json::List(js)) => {
528528
for js.each |j| {
529529
match *j {
530-
json::String(j) => vec::grow(tags, 1u, j),
530+
json::String(ref j) => tags.grow(1u, j),
531531
_ => ()
532532
}
533533
}

trunk/src/compiletest/runtest.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -503,10 +503,7 @@ fn make_run_args(config: config, _props: test_props, testfile: &Path) ->
503503

504504
fn split_maybe_args(argstr: Option<~str>) -> ~[~str] {
505505
fn rm_whitespace(v: ~[~str]) -> ~[~str] {
506-
fn flt(&&s: ~str) -> Option<~str> {
507-
if !str::is_whitespace(s) { option::Some(s) } else { option::None }
508-
}
509-
vec::filter_map(v, flt)
506+
vec::filter(v, |s| !str::is_whitespace(*s))
510507
}
511508

512509
match argstr {

trunk/src/fuzzer/fuzzer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ fn check_variants_of_ast(crate: ast::crate, codemap: codemap::codemap,
229229
filename: &Path, cx: context) {
230230
let stolen = steal(crate, cx.mode);
231231
let extra_exprs = vec::filter(common_exprs(),
232-
|a| safe_to_use_expr(a, cx.mode) );
232+
|a| safe_to_use_expr(*a, cx.mode) );
233233
check_variants_T(crate, codemap, filename, ~"expr",
234234
extra_exprs + stolen.exprs, pprust::expr_to_str,
235235
replace_expr_in_crate, cx);

trunk/src/libcore/dlist.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ pub pure fn from_elem<T>(+data: T) -> DList<T> {
9999

100100
pub fn from_vec<T: Copy>(+vec: &[T]) -> DList<T> {
101101
do vec::foldl(DList(), vec) |list,data| {
102-
list.push(data); // Iterating left-to-right -- add newly to the tail.
102+
list.push(*data); // Iterating left-to-right -- add newly to the tail.
103103
list
104104
}
105105
}

trunk/src/libcore/dvec.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ impl<A> DVec<A> {
157157
fn pop() -> A {
158158
do self.check_out |v| {
159159
let mut v <- v;
160-
let result = vec::pop(v);
160+
let result = v.pop();
161161
self.give_back(move v);
162162
move result
163163
}
@@ -187,7 +187,7 @@ impl<A> DVec<A> {
187187
fn shift() -> A {
188188
do self.check_out |v| {
189189
let mut v = move v;
190-
let result = vec::shift(v);
190+
let result = v.shift();
191191
self.give_back(move v);
192192
move result
193193
}
@@ -305,10 +305,10 @@ impl<A: Copy> DVec<A> {
305305
* growing the vector if necessary. New elements will be initialized
306306
* with `initval`
307307
*/
308-
fn grow_set_elt(idx: uint, initval: A, +val: A) {
308+
fn grow_set_elt(idx: uint, initval: &A, +val: A) {
309309
do self.swap |v| {
310310
let mut v = move v;
311-
vec::grow_set(v, idx, initval, val);
311+
v.grow_set(idx, initval, val);
312312
move v
313313
}
314314
}

trunk/src/libcore/float.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ pub fn to_str_common(num: float, digits: uint, exact: bool) -> ~str {
140140
// turn digits into string
141141
// using stack of digits
142142
while fractionalParts.is_not_empty() {
143-
let mut adjusted_digit = carry + vec::pop(fractionalParts);
143+
let mut adjusted_digit = carry + fractionalParts.pop();
144144

145145
if adjusted_digit == 10 {
146146
carry = 1;

trunk/src/libcore/io.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ trait ReaderUtil {
6464
impl<T: Reader> T : ReaderUtil {
6565
fn read_bytes(len: uint) -> ~[u8] {
6666
let mut buf = vec::with_capacity(len);
67-
unsafe { vec::raw::set_len(buf, len); }
67+
unsafe { vec::raw::set_len(&mut buf, len); }
6868

6969
let count = self.read(buf, len);
7070

71-
unsafe { vec::raw::set_len(buf, count); }
71+
unsafe { vec::raw::set_len(&mut buf, count); }
7272
move buf
7373
}
7474
fn read_line() -> ~str {
@@ -695,7 +695,7 @@ impl BytesWriter: Writer {
695695
696696
let count = uint::max(buf_len, self.pos + v_len);
697697
vec::reserve(&mut buf, count);
698-
unsafe { vec::raw::set_len(buf, count); }
698+
unsafe { vec::raw::set_len(&mut buf, count); }
699699
700700
{
701701
let view = vec::mut_view(buf, self.pos, count);

trunk/src/libcore/os.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ pub fn list_dir(p: &Path) -> ~[~str] {
582582
fn star(p: &Path) -> Path { p.push("*") }
583583

584584
do rustrt::rust_list_files(star(p).to_str()).filter |filename| {
585-
filename != ~"." && filename != ~".."
585+
*filename != ~"." && *filename != ~".."
586586
}
587587
}
588588
@@ -857,10 +857,10 @@ mod tests {
857857

858858
let mut e = env();
859859
setenv(n, ~"VALUE");
860-
assert !vec::contains(e, (copy n, ~"VALUE"));
860+
assert !vec::contains(e, &(copy n, ~"VALUE"));
861861

862862
e = env();
863-
assert vec::contains(e, (n, ~"VALUE"));
863+
assert vec::contains(e, &(n, ~"VALUE"));
864864
}
865865

866866
#[test]

trunk/src/libcore/path.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ impl PosixPath : GenericPath {
221221
pure fn pop() -> PosixPath {
222222
let mut cs = copy self.components;
223223
if cs.len() != 0 {
224-
unsafe { vec::pop(cs); }
224+
unsafe { cs.pop(); }
225225
}
226226
return PosixPath { components: move cs, ..self }
227227
}
@@ -415,7 +415,7 @@ impl WindowsPath : GenericPath {
415415
pure fn pop() -> WindowsPath {
416416
let mut cs = copy self.components;
417417
if cs.len() != 0 {
418-
unsafe { vec::pop(cs); }
418+
unsafe { cs.pop(); }
419419
}
420420
return WindowsPath { components: move cs, ..self }
421421
}
@@ -437,7 +437,7 @@ pub pure fn normalize(components: &[~str]) -> ~[~str] {
437437
if *c == ~"." && components.len() > 1 { loop; }
438438
if *c == ~"" { loop; }
439439
if *c == ~".." && cs.len() != 0 {
440-
vec::pop(cs);
440+
cs.pop();
441441
loop;
442442
}
443443
cs.push(copy *c);

trunk/src/libcore/pipes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ pub fn select<T: Send, Tb: Send>(+endpoints: ~[RecvPacketBuffered<T, Tb>])
704704
{
705705
let ready = wait_many(endpoints.map(|p| p.header()));
706706
let mut remaining <- endpoints;
707-
let port = vec::swap_remove(remaining, ready);
707+
let port = remaining.swap_remove(ready);
708708
let result = try_recv(move port);
709709
(ready, move result, move remaining)
710710
}
@@ -1067,7 +1067,7 @@ impl<T: Send> PortSet<T> : Recv<T> {
10671067
}
10681068
None => {
10691069
// Remove this port.
1070-
let _ = vec::swap_remove(ports, i);
1070+
let _ = ports.swap_remove(i);
10711071
}
10721072
}
10731073
}

trunk/src/libcore/ptr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ pub unsafe fn memset<T>(dst: *mut T, c: int, count: uint) {
127127
reinterpret_cast.
128128
*/
129129
#[inline(always)]
130-
pub fn to_unsafe_ptr<T>(thing: &T) -> *T {
130+
pub pure fn to_unsafe_ptr<T>(thing: &T) -> *T {
131131
unsafe { cast::reinterpret_cast(&thing) }
132132
}
133133

@@ -137,7 +137,7 @@ pub fn to_unsafe_ptr<T>(thing: &T) -> *T {
137137
reinterpret_cast.
138138
*/
139139
#[inline(always)]
140-
pub fn to_const_unsafe_ptr<T>(thing: &const T) -> *const T {
140+
pub pure fn to_const_unsafe_ptr<T>(thing: &const T) -> *const T {
141141
unsafe { cast::reinterpret_cast(&thing) }
142142
}
143143

@@ -147,7 +147,7 @@ pub fn to_const_unsafe_ptr<T>(thing: &const T) -> *const T {
147147
reinterpret_cast.
148148
*/
149149
#[inline(always)]
150-
pub fn to_mut_unsafe_ptr<T>(thing: &mut T) -> *mut T {
150+
pub pure fn to_mut_unsafe_ptr<T>(thing: &mut T) -> *mut T {
151151
unsafe { cast::reinterpret_cast(&thing) }
152152
}
153153

trunk/src/libcore/str.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ Section: Transforming strings
450450
*/
451451
pure fn to_bytes(s: &str) -> ~[u8] unsafe {
452452
let mut v: ~[u8] = ::cast::transmute(from_slice(s));
453-
vec::raw::set_len(v, len(s));
453+
vec::raw::set_len(&mut v, len(s));
454454
move v
455455
}
456456

@@ -1945,7 +1945,7 @@ fn reserve_at_least(s: &const ~str, n: uint) {
19451945
*/
19461946
pure fn capacity(s: &const ~str) -> uint {
19471947
do as_bytes(s) |buf| {
1948-
let vcap = vec::capacity(*buf);
1948+
let vcap = vec::capacity(buf);
19491949
assert vcap > 0u;
19501950
vcap - 1u
19511951
}
@@ -2008,7 +2008,7 @@ mod raw {
20082008
vec::as_mut_buf(v, |vbuf, _len| {
20092009
ptr::memcpy(vbuf, buf as *u8, len)
20102010
});
2011-
vec::raw::set_len(v, len);
2011+
vec::raw::set_len(&mut v, len);
20122012
v.push(0u8);
20132013

20142014
assert is_utf8(v);
@@ -2065,7 +2065,7 @@ mod raw {
20652065
let src = ptr::offset(sbuf, begin);
20662066
ptr::memcpy(vbuf, src, end - begin);
20672067
}
2068-
vec::raw::set_len(v, end - begin);
2068+
vec::raw::set_len(&mut v, end - begin);
20692069
v.push(0u8);
20702070
::cast::transmute(move v)
20712071
}

trunk/src/libcore/tuple.rs

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,35 +35,44 @@ impl<T: Copy, U: Copy> (T, U): TupleOps<T,U> {
3535
}
3636

3737
trait ExtendedTupleOps<A,B> {
38-
fn zip() -> ~[(A, B)];
39-
fn map<C>(f: &fn(A, B) -> C) -> ~[C];
38+
fn zip(&self) -> ~[(A, B)];
39+
fn map<C>(&self, f: &fn(a: &A, b: &B) -> C) -> ~[C];
4040
}
4141

4242
impl<A: Copy, B: Copy> (&[A], &[B]): ExtendedTupleOps<A,B> {
43-
44-
fn zip() -> ~[(A, B)] {
45-
let (a, b) = self;
46-
vec::zip_slice(a, b)
43+
fn zip(&self) -> ~[(A, B)] {
44+
match *self {
45+
(ref a, ref b) => {
46+
vec::zip_slice(*a, *b)
47+
}
48+
}
4749
}
4850

49-
fn map<C>(f: &fn(A, B) -> C) -> ~[C] {
50-
let (a, b) = self;
51-
vec::map2(a, b, f)
51+
fn map<C>(&self, f: &fn(a: &A, b: &B) -> C) -> ~[C] {
52+
match *self {
53+
(ref a, ref b) => {
54+
vec::map2(*a, *b, f)
55+
}
56+
}
5257
}
5358
}
5459

5560
impl<A: Copy, B: Copy> (~[A], ~[B]): ExtendedTupleOps<A,B> {
5661

57-
fn zip() -> ~[(A, B)] {
58-
// FIXME #2543: Bad copy
59-
let (a, b) = copy self;
60-
vec::zip(move a, move b)
62+
fn zip(&self) -> ~[(A, B)] {
63+
match *self {
64+
(ref a, ref b) => {
65+
vec::zip_slice(*a, *b)
66+
}
67+
}
6168
}
6269

63-
fn map<C>(f: &fn(A, B) -> C) -> ~[C] {
64-
// FIXME #2543: Bad copy
65-
let (a, b) = copy self;
66-
vec::map2(a, b, f)
70+
fn map<C>(&self, f: &fn(a: &A, b: &B) -> C) -> ~[C] {
71+
match *self {
72+
(ref a, ref b) => {
73+
vec::map2(*a, *b, f)
74+
}
75+
}
6776
}
6877
}
6978

0 commit comments

Comments
 (0)