Skip to content

Commit b7af6e5

Browse files
committed
---
yaml --- r: 35931 b: refs/heads/try2 c: 30a6279 h: refs/heads/master i: 35929: a8a8243 35927: 7b3f300 v: v3
1 parent 0ff7164 commit b7af6e5

File tree

23 files changed

+179
-147
lines changed

23 files changed

+179
-147
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: eb8fd119c65c67f3b1b8268cc7341c22d39b7b61
55
refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 2d7d12b902a9f6237994f74888878220cb2ffbed
8+
refs/heads/try2: 30a62793fa54a413a265591879c9775b798d762c
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
1010
refs/heads/dist-snap: 22efa39382d41b084fde1719df7ae8ce5697d8c9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try2/src/libcore/cast.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ pub mod tests {
122122
pub fn test_transmute() {
123123
unsafe {
124124
let x = @1;
125-
let x: *int = transmute(x);
125+
let x: *int = transmute(move x);
126126
assert *x == 1;
127-
let _x: @int = transmute(x);
127+
let _x: @int = transmute(move x);
128128
}
129129
}
130130

branches/try2/src/libcore/cleanup.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ pub unsafe fn annihilate() {
142142
assert (*box).header.prev == null();
143143

144144
debug!("freeing box: %x", box as uint);
145-
rt_free(transmute(box));
145+
rt_free(transmute(move box));
146146
}
147147
}
148148

branches/try2/src/libcore/extfmt.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ pub mod rt {
301301
unsafe { str::unshift_char(&mut s, ' ') };
302302
}
303303
}
304-
return unsafe { pad(cv, s, PadSigned) };
304+
return unsafe { pad(cv, move s, PadSigned) };
305305
}
306306
pub pure fn conv_uint(cv: Conv, u: uint) -> ~str {
307307
let prec = get_int_precision(cv);
@@ -313,7 +313,7 @@ pub mod rt {
313313
TyBits => uint_to_str_prec(u, 2u, prec),
314314
TyOctal => uint_to_str_prec(u, 8u, prec)
315315
};
316-
return unsafe { pad(cv, rs, PadUnsigned) };
316+
return unsafe { pad(cv, move rs, PadUnsigned) };
317317
}
318318
pub pure fn conv_bool(cv: Conv, b: bool) -> ~str {
319319
let s = if b { ~"true" } else { ~"false" };
@@ -323,7 +323,7 @@ pub mod rt {
323323
}
324324
pub pure fn conv_char(cv: Conv, c: char) -> ~str {
325325
let mut s = str::from_char(c);
326-
return unsafe { pad(cv, s, PadNozero) };
326+
return unsafe { pad(cv, move s, PadNozero) };
327327
}
328328
pub pure fn conv_str(cv: Conv, s: &str) -> ~str {
329329
// For strings, precision is the maximum characters
@@ -336,7 +336,7 @@ pub mod rt {
336336
s.to_unique()
337337
}
338338
};
339-
return unsafe { pad(cv, unpadded, PadNozero) };
339+
return unsafe { pad(cv, move unpadded, PadNozero) };
340340
}
341341
pub pure fn conv_float(cv: Conv, f: float) -> ~str {
342342
let (to_str, digits) = match cv.precision {
@@ -351,7 +351,7 @@ pub mod rt {
351351
s = ~" " + s;
352352
}
353353
}
354-
return unsafe { pad(cv, s, PadFloat) };
354+
return unsafe { pad(cv, move s, PadFloat) };
355355
}
356356
pub pure fn conv_poly<T>(cv: Conv, v: &T) -> ~str {
357357
let s = sys::log_str(v);
@@ -411,14 +411,14 @@ pub mod rt {
411411
pub fn pad(cv: Conv, s: ~str, mode: PadMode) -> ~str {
412412
let mut s = move s; // sadtimes
413413
let uwidth : uint = match cv.width {
414-
CountImplied => return s,
414+
CountImplied => return (move s),
415415
CountIs(width) => {
416416
// FIXME: width should probably be uint (see Issue #1996)
417417
width as uint
418418
}
419419
};
420420
let strlen = str::char_len(s);
421-
if uwidth <= strlen { return s; }
421+
if uwidth <= strlen { return (move s); }
422422
let mut padchar = ' ';
423423
let diff = uwidth - strlen;
424424
if have_flag(cv.flags, flag_left_justify) {

branches/try2/src/libcore/future.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ pub mod test {
179179
#[test]
180180
pub fn test_from_port() {
181181
let (po, ch) = future_pipe::init();
182-
future_pipe::server::completed(ch, ~"whale");
183-
let f = from_port(po);
182+
future_pipe::server::completed(move ch, ~"whale");
183+
let f = from_port(move po);
184184
assert get(&f) == ~"whale";
185185
}
186186

@@ -238,7 +238,7 @@ pub mod test {
238238
pub fn test_sendable_future() {
239239
let expected = ~"schlorf";
240240
let f = do spawn |copy expected| { copy expected };
241-
do task::spawn {
241+
do task::spawn |move f, move expected| {
242242
let actual = get(&f);
243243
assert actual == expected;
244244
}

branches/try2/src/libcore/hash.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ pub fn test_siphash() {
438438
for vec::each(*r) |b| {
439439
s += uint::to_str(*b as uint, 16u);
440440
}
441-
return s;
441+
move s
442442
}
443443

444444
while t < 64 {

branches/try2/src/libcore/io.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ pub fn BytesWriter() -> BytesWriter {
737737
pub fn with_bytes_writer(f: fn(Writer)) -> ~[u8] {
738738
let wr = @BytesWriter();
739739
f(wr as Writer);
740-
wr.buf.check_out(|buf| buf)
740+
wr.buf.check_out(|buf| move buf)
741741
}
742742
743743
pub fn with_str_writer(f: fn(Writer)) -> ~str {
@@ -747,7 +747,7 @@ pub fn with_str_writer(f: fn(Writer)) -> ~str {
747747
v.push(0);
748748
assert str::is_utf8(v);
749749
750-
unsafe { move ::cast::transmute(v) }
750+
unsafe { move ::cast::transmute(move v) }
751751
}
752752
753753
// Utility functions

branches/try2/src/libcore/mutable.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ struct Data<T> {
2424
pub type Mut<T> = Data<T>;
2525

2626
pub fn Mut<T>(t: T) -> Mut<T> {
27-
Data {value: t, mode: ReadOnly}
27+
Data {value: move t, mode: ReadOnly}
2828
}
2929

3030
pub fn unwrap<T>(m: Mut<T>) -> T {
3131
// Borrowck should prevent us from calling unwrap while the value
3232
// is in use, as that would be a move from a borrowed value.
3333
assert (m.mode as uint) == (ReadOnly as uint);
3434
let Data {value: move value, mode: _} = move m;
35-
return value;
35+
move value
3636
}
3737

3838
impl<T> Data<T> {

branches/try2/src/libcore/option.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ pub pure fn chain<T, U>(opt: Option<T>,
120120
*/
121121

122122
match move opt {
123-
Some(move t) => f(t),
123+
Some(move t) => f(move t),
124124
None => None
125125
}
126126
}
@@ -294,7 +294,7 @@ impl<T: Copy> Option<T> {
294294
*
295295
* Fails if the value equals `none`
296296
*/
297-
pure fn expect(reason: ~str) -> T { expect(&self, reason) }
297+
pure fn expect(reason: ~str) -> T { expect(&self, move reason) }
298298
/// Applies a function zero or more times until the result is none.
299299
pure fn while_some(blk: fn(v: T) -> Option<T>) { while_some(self, blk) }
300300
}
@@ -324,8 +324,8 @@ impl<T: Eq> Option<T> : Eq {
324324
fn test_unwrap_ptr() {
325325
let x = ~0;
326326
let addr_x = ptr::addr_of(&(*x));
327-
let opt = Some(x);
328-
let y = unwrap(opt);
327+
let opt = Some(move x);
328+
let y = unwrap(move opt);
329329
let addr_y = ptr::addr_of(&(*y));
330330
assert addr_x == addr_y;
331331
}
@@ -356,8 +356,8 @@ fn test_unwrap_resource() {
356356
let i = @mut 0;
357357
{
358358
let x = R(i);
359-
let opt = Some(x);
360-
let _y = unwrap(opt);
359+
let opt = Some(move x);
360+
let _y = unwrap(move opt);
361361
}
362362
assert *i == 1;
363363
}

branches/try2/src/libcore/os.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ unsafe fn load_argc_and_argv(argc: c_int, argv: **c_char) -> ~[~str] {
739739
for uint::range(0, argc as uint) |i| {
740740
vec::push(&mut args, str::raw::from_c_str(*argv.offset(i)));
741741
}
742-
return args;
742+
move args
743743
}
744744

745745
/**
@@ -903,7 +903,7 @@ mod tests {
903903
let rng: rand::Rng = rand::Rng();
904904
let n = ~"TEST" + rng.gen_str(10u);
905905
assert getenv(n).is_none();
906-
n
906+
move n
907907
}
908908

909909
#[test]
@@ -937,7 +937,7 @@ mod tests {
937937
let n = make_rand_name();
938938
setenv(n, s);
939939
log(debug, s);
940-
assert getenv(n) == option::Some(s);
940+
assert getenv(n) == option::Some(move s);
941941
}
942942

943943
#[test]
@@ -963,7 +963,7 @@ mod tests {
963963
// MingW seems to set some funky environment variables like
964964
// "=C:=C:\MinGW\msys\1.0\bin" and "!::=::\" that are returned
965965
// from env() but not visible from getenv().
966-
assert v2.is_none() || v2 == option::Some(v);
966+
assert v2.is_none() || v2 == option::Some(move v);
967967
}
968968
}
969969

@@ -976,7 +976,7 @@ mod tests {
976976
assert !vec::contains(e, &(copy n, ~"VALUE"));
977977

978978
e = env();
979-
assert vec::contains(e, &(n, ~"VALUE"));
979+
assert vec::contains(e, &(move n, ~"VALUE"));
980980
}
981981

982982
#[test]

branches/try2/src/libcore/path.rs

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl PosixPath : GenericPath {
9696
let mut components = str::split_nonempty(s, |c| c == '/');
9797
let is_absolute = (s.len() != 0 && s[0] == '/' as u8);
9898
return PosixPath { is_absolute: is_absolute,
99-
components: components }
99+
components: move components }
100100
}
101101

102102
pure fn dirname() -> ~str {
@@ -192,7 +192,7 @@ impl PosixPath : GenericPath {
192192
Some(ref f) => ~[copy *f]
193193
};
194194
return PosixPath { is_absolute: false,
195-
components: cs }
195+
components: move cs }
196196
}
197197

198198
pure fn push_rel(other: &PosixPath) -> PosixPath {
@@ -208,7 +208,8 @@ impl PosixPath : GenericPath {
208208
|c| windows::is_sep(c as u8));
209209
unsafe { v.push_all_move(move ss); }
210210
}
211-
PosixPath { components: move v, ..self }
211+
PosixPath { is_absolute: self.is_absolute,
212+
components: move v }
212213
}
213214

214215
pure fn push(s: &str) -> PosixPath {
@@ -223,13 +224,18 @@ impl PosixPath : GenericPath {
223224
if cs.len() != 0 {
224225
unsafe { cs.pop(); }
225226
}
226-
return PosixPath { components: move cs, ..self }
227+
return PosixPath {
228+
is_absolute: self.is_absolute,
229+
components: move cs
230+
}
231+
//..self }
227232
}
228233

229234
pure fn normalize() -> PosixPath {
230235
return PosixPath {
231-
components: normalize(self.components),
232-
..self
236+
is_absolute: self.is_absolute,
237+
components: normalize(self.components)
238+
// ..self
233239
}
234240
}
235241
}
@@ -286,10 +292,10 @@ impl WindowsPath : GenericPath {
286292
let mut components =
287293
str::split_nonempty(rest, |c| windows::is_sep(c as u8));
288294
let is_absolute = (rest.len() != 0 && windows::is_sep(rest[0]));
289-
return WindowsPath { host: host,
290-
device: device,
295+
return WindowsPath { host: move host,
296+
device: move device,
291297
is_absolute: is_absolute,
292-
components: components }
298+
components: move components }
293299
}
294300

295301
pure fn dirname() -> ~str {
@@ -386,7 +392,7 @@ impl WindowsPath : GenericPath {
386392
return WindowsPath { host: None,
387393
device: None,
388394
is_absolute: false,
389-
components: cs }
395+
components: move cs }
390396
}
391397

392398
pure fn push_rel(other: &WindowsPath) -> WindowsPath {
@@ -402,7 +408,13 @@ impl WindowsPath : GenericPath {
402408
|c| windows::is_sep(c as u8));
403409
unsafe { v.push_all_move(move ss); }
404410
}
405-
return WindowsPath { components: move v, ..self }
411+
// tedious, but as-is, we can't use ..self
412+
return WindowsPath {
413+
host: copy self.host,
414+
device: copy self.device,
415+
is_absolute: self.is_absolute,
416+
components: move v
417+
}
406418
}
407419

408420
pure fn push(s: &str) -> WindowsPath {
@@ -417,13 +429,20 @@ impl WindowsPath : GenericPath {
417429
if cs.len() != 0 {
418430
unsafe { cs.pop(); }
419431
}
420-
return WindowsPath { components: move cs, ..self }
432+
return WindowsPath {
433+
host: copy self.host,
434+
device: copy self.device,
435+
is_absolute: self.is_absolute,
436+
components: move cs
437+
}
421438
}
422439

423440
pure fn normalize() -> WindowsPath {
424441
return WindowsPath {
425-
components: normalize(self.components),
426-
..self
442+
host: copy self.host,
443+
device: copy self.device,
444+
is_absolute: self.is_absolute,
445+
components: normalize(self.components)
427446
}
428447
}
429448
}

branches/try2/src/libcore/pipes.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,8 @@ fn BufferResource<T: Send>(b: ~Buffer<T>) -> BufferResource<T> {
350350
atomic_add_acq(&mut b.header.ref_count, 1);
351351

352352
BufferResource {
353-
buffer: b
353+
// tjc: ????
354+
buffer: move b
354355
}
355356
}
356357

@@ -448,7 +449,12 @@ pub fn try_recv<T: Send, Tbuffer: Send>(p: RecvPacketBuffered<T, Tbuffer>)
448449
let this = rustrt::rust_get_task();
449450
rustrt::task_clear_event_reject(this);
450451
rustrt::rust_task_ref(this);
452+
debug!("blocked = %x this = %x", p.header.blocked_task as uint,
453+
this as uint);
451454
let old_task = swap_task(&mut p.header.blocked_task, this);
455+
debug!("blocked = %x this = %x old_task = %x",
456+
p.header.blocked_task as uint,
457+
this as uint, old_task as uint);
452458
assert old_task.is_null();
453459
let mut first = true;
454460
let mut count = SPIN_COUNT;
@@ -1212,7 +1218,7 @@ pub mod test {
12121218

12131219
c1.send(~"abc");
12141220

1215-
match (p1, p2).select() {
1221+
match (move p1, move p2).select() {
12161222
Right(_) => fail,
12171223
_ => ()
12181224
}
@@ -1224,8 +1230,8 @@ pub mod test {
12241230
pub fn test_oneshot() {
12251231
let (c, p) = oneshot::init();
12261232

1227-
oneshot::client::send(c, ());
1233+
oneshot::client::send(move c, ());
12281234

1229-
recv_one(p)
1235+
recv_one(move p)
12301236
}
12311237
}

0 commit comments

Comments
 (0)