Skip to content

Commit e011e6d

Browse files
committed
---
yaml --- r: 50709 b: refs/heads/try c: 6859a6d h: refs/heads/master i: 50707: 6aa4140 v: v3
1 parent ca5d830 commit e011e6d

Some content is hidden

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

49 files changed

+104
-131
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: 5f13e9ccc2e3328d4cd8ca49f84e6840dd998346
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: f7a2371c176663d59062ec5158f39faecba45768
5-
refs/heads/try: ee5842494a9170d6e1079a671695fcfc32ceb920
5+
refs/heads/try: 6859a6d9a327d7fcd81a38c8e3af6aa0005f7944
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libcore/clone.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ impl Clone for () {
2020
fn clone(&self) -> () { () }
2121
}
2222

23-
impl<T:Clone> Clone for ~T {
24-
#[inline(always)]
25-
fn clone(&self) -> ~T { ~(**self).clone() }
26-
}
27-
2823
macro_rules! clone_impl(
2924
($t:ty) => {
3025
impl Clone for $t {

branches/try/src/libcore/str.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
use at_vec;
2121
use cast;
2222
use char;
23-
use clone::Clone;
2423
use cmp::{Equiv, TotalOrd, Ordering, Less, Equal, Greater};
2524
use libc;
2625
use option::{None, Option, Some};
@@ -2274,6 +2273,7 @@ pub trait StrSlice {
22742273
pure fn to_owned(&self) -> ~str;
22752274
pure fn to_managed(&self) -> @str;
22762275
pure fn char_at(&self, i: uint) -> char;
2276+
fn to_bytes(&self) -> ~[u8];
22772277
}
22782278
22792279
/// Extension methods for strings
@@ -2417,6 +2417,8 @@ impl StrSlice for &self/str {
24172417
24182418
#[inline]
24192419
pure fn char_at(&self, i: uint) -> char { char_at(*self, i) }
2420+
2421+
fn to_bytes(&self) -> ~[u8] { to_bytes(*self) }
24202422
}
24212423
24222424
pub trait OwnedStr {
@@ -2434,13 +2436,6 @@ impl OwnedStr for ~str {
24342436
}
24352437
}
24362438
2437-
impl Clone for ~str {
2438-
#[inline(always)]
2439-
fn clone(&self) -> ~str {
2440-
self.to_str() // hilarious
2441-
}
2442-
}
2443-
24442439
#[cfg(test)]
24452440
mod tests {
24462441
use char;

branches/try/src/libcore/unstable/global.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ unsafe fn global_data_clone_create_<T:Owned + Clone>(
6868
match value {
6969
None => {
7070
let value = create();
71-
clone_value = Some((*value).clone());
71+
clone_value = Some(value.clone());
7272
Some(value)
7373
}
7474
Some(value) => {
75-
clone_value = Some((*value).clone());
75+
clone_value = Some(value.clone());
7676
Some(value)
7777
}
7878
}
@@ -193,7 +193,7 @@ fn get_global_state() -> Exclusive<GlobalState> {
193193
// Successfully installed the global pointer
194194

195195
// Take a handle to return
196-
let clone = (*state).clone();
196+
let clone = state.clone();
197197

198198
// Install a runtime exit function to destroy the global object
199199
do at_exit {

branches/try/src/libcore/vec.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use container::{Container, Mutable};
1616
use cast;
1717
use cmp::{Eq, Equiv, Ord, TotalOrd, Ordering, Less, Equal, Greater};
18-
use clone::Clone;
1918
use iter::BaseIter;
2019
use iter;
2120
use kinds::Copy;
@@ -2502,18 +2501,6 @@ impl<A:Copy> iter::CopyableNonstrictIter<A> for @[A] {
25022501
}
25032502
}
25042503

2505-
impl<A:Clone> Clone for ~[A] {
2506-
#[inline]
2507-
fn clone(&self) -> ~[A] {
2508-
let mut dolly = ~[];
2509-
vec::reserve(&mut dolly, self.len());
2510-
for self.each |item| {
2511-
dolly.push(item.clone());
2512-
}
2513-
return dolly;
2514-
}
2515-
}
2516-
25172504
// ___________________________________________________________________________
25182505

25192506
#[cfg(test)]

branches/try/src/libstd/arc.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ mod tests {
572572
#[test] #[should_fail] #[ignore(cfg(windows))]
573573
pub fn test_rw_arc_poison_wr() {
574574
let arc = ~RWARC(1);
575-
let arc2 = (*arc).clone();
575+
let arc2 = ~arc.clone();
576576
do task::try || {
577577
do arc2.write |one| {
578578
fail_unless!(*one == 2);
@@ -585,7 +585,7 @@ mod tests {
585585
#[test] #[should_fail] #[ignore(cfg(windows))]
586586
pub fn test_rw_arc_poison_ww() {
587587
let arc = ~RWARC(1);
588-
let arc2 = (*arc).clone();
588+
let arc2 = ~arc.clone();
589589
do task::try || {
590590
do arc2.write |one| {
591591
fail_unless!(*one == 2);
@@ -598,7 +598,7 @@ mod tests {
598598
#[test] #[should_fail] #[ignore(cfg(windows))]
599599
pub fn test_rw_arc_poison_dw() {
600600
let arc = ~RWARC(1);
601-
let arc2 = (*arc).clone();
601+
let arc2 = ~arc.clone();
602602
do task::try || {
603603
do arc2.write_downgrade |write_mode| {
604604
do (&write_mode).write |one| {
@@ -613,7 +613,7 @@ mod tests {
613613
#[test] #[ignore(cfg(windows))]
614614
pub fn test_rw_arc_no_poison_rr() {
615615
let arc = ~RWARC(1);
616-
let arc2 = (*arc).clone();
616+
let arc2 = ~arc.clone();
617617
do task::try || {
618618
do arc2.read |one| {
619619
fail_unless!(*one == 2);
@@ -626,7 +626,7 @@ mod tests {
626626
#[test] #[ignore(cfg(windows))]
627627
pub fn test_rw_arc_no_poison_rw() {
628628
let arc = ~RWARC(1);
629-
let arc2 = (*arc).clone();
629+
let arc2 = ~arc.clone();
630630
do task::try || {
631631
do arc2.read |one| {
632632
fail_unless!(*one == 2);
@@ -639,7 +639,7 @@ mod tests {
639639
#[test] #[ignore(cfg(windows))]
640640
pub fn test_rw_arc_no_poison_dr() {
641641
let arc = ~RWARC(1);
642-
let arc2 = (*arc).clone();
642+
let arc2 = ~arc.clone();
643643
do task::try || {
644644
do arc2.write_downgrade |write_mode| {
645645
let read_mode = arc2.downgrade(write_mode);
@@ -655,7 +655,7 @@ mod tests {
655655
#[test]
656656
pub fn test_rw_arc() {
657657
let arc = ~RWARC(0);
658-
let arc2 = (*arc).clone();
658+
let arc2 = ~arc.clone();
659659
let (p,c) = comm::stream();
660660

661661
do task::spawn || {
@@ -673,7 +673,7 @@ mod tests {
673673
// Readers try to catch the writer in the act
674674
let mut children = ~[];
675675
for 5.times {
676-
let arc3 = (*arc).clone();
676+
let arc3 = ~arc.clone();
677677
do task::task().future_result(|+r| children.push(r)).spawn
678678
|| {
679679
do arc3.read |num| {
@@ -704,7 +704,7 @@ mod tests {
704704
for 10.times {
705705
let ((rp1,rc1),(rp2,rc2)) = (comm::stream(),comm::stream());
706706
reader_convos.push((rc1, rp2));
707-
let arcn = (*arc).clone();
707+
let arcn = ~arc.clone();
708708
do task::spawn || {
709709
rp1.recv(); // wait for downgrader to give go-ahead
710710
do arcn.read |state| {
@@ -715,7 +715,7 @@ mod tests {
715715
}
716716

717717
// Writer task
718-
let arc2 = (*arc).clone();
718+
let arc2 = ~arc.clone();
719719
let ((wp1,wc1),(wp2,wc2)) = (comm::stream(),comm::stream());
720720
do task::spawn || {
721721
wp1.recv();

branches/try/src/libstd/sync.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ mod tests {
827827
// "load tmp = move ptr; inc tmp; store ptr <- tmp" dance.
828828
let (p,c) = comm::stream();
829829
let m = ~Mutex();
830-
let m2 = m.clone();
830+
let m2 = ~m.clone();
831831
let mut sharedstate = ~0;
832832
let ptr = ptr::addr_of(&(*sharedstate));
833833
do task::spawn || {
@@ -1105,13 +1105,13 @@ mod tests {
11051105
// Test mutual exclusion between readers and writers. Just like the
11061106
// mutex mutual exclusion test, a ways above.
11071107
let (p,c) = comm::stream();
1108-
let x2 = (*x).clone();
1108+
let x2 = ~x.clone();
11091109
let mut sharedstate = ~0;
11101110
let ptr = ptr::addr_of(&(*sharedstate));
11111111
do task::spawn || {
11121112
let sharedstate: &mut int =
11131113
unsafe { cast::reinterpret_cast(&ptr) };
1114-
access_shared(sharedstate, &x2, mode1, 10);
1114+
access_shared(sharedstate, x2, mode1, 10);
11151115
c.send(());
11161116
}
11171117
access_shared(sharedstate, x, mode2, 10);
@@ -1150,14 +1150,14 @@ mod tests {
11501150
mode2: RWlockMode,
11511151
make_mode2_go_first: bool) {
11521152
// Much like sem_multi_resource.
1153-
let x2 = (*x).clone();
1153+
let x2 = ~x.clone();
11541154
let (p1,c1) = comm::stream();
11551155
let (p2,c2) = comm::stream();
11561156
do task::spawn || {
11571157
if !make_mode2_go_first {
11581158
let _ = p2.recv(); // parent sends to us once it locks, or ...
11591159
}
1160-
do lock_rwlock_in_mode(&x2, mode2) {
1160+
do lock_rwlock_in_mode(x2, mode2) {
11611161
if make_mode2_go_first {
11621162
c1.send(()); // ... we send to it once we lock
11631163
}
@@ -1207,7 +1207,7 @@ mod tests {
12071207
12081208
// Child wakes up parent
12091209
do x.write_cond |cond| {
1210-
let x2 = (*x).clone();
1210+
let x2 = ~x.clone();
12111211
do task::spawn || {
12121212
do x2.write_cond |cond| {
12131213
let woken = cond.signal();
@@ -1218,7 +1218,7 @@ mod tests {
12181218
}
12191219
// Parent wakes up child
12201220
let (port,chan) = comm::stream();
1221-
let x3 = (*x).clone();
1221+
let x3 = ~x.clone();
12221222
do task::spawn || {
12231223
do x3.write_cond |cond| {
12241224
chan.send(());
@@ -1253,11 +1253,11 @@ mod tests {
12531253
let mut ports = ~[];
12541254
12551255
for num_waiters.times {
1256-
let xi = (*x).clone();
1256+
let xi = ~x.clone();
12571257
let (port, chan) = comm::stream();
12581258
ports.push(port);
12591259
do task::spawn || {
1260-
do lock_cond(&xi, dg1) |cond| {
1260+
do lock_cond(xi, dg1) |cond| {
12611261
chan.send(());
12621262
cond.wait();
12631263
chan.send(());
@@ -1289,10 +1289,10 @@ mod tests {
12891289
pub fn rwlock_kill_helper(mode1: RWlockMode, mode2: RWlockMode) {
12901290
// Mutex must get automatically unlocked if failed/killed within.
12911291
let x = ~RWlock();
1292-
let x2 = (*x).clone();
1292+
let x2 = ~x.clone();
12931293
12941294
let result: result::Result<(),()> = do task::try || {
1295-
do lock_rwlock_in_mode(&x2, mode1) {
1295+
do lock_rwlock_in_mode(x2, mode1) {
12961296
fail!();
12971297
}
12981298
};

branches/try/src/libsyntax/codemap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ impl cmp::Eq for span {
140140

141141
impl<S:Encoder> Encodable<S> for span {
142142
/* Note #1972 -- spans are encoded but not decoded */
143-
fn encode(&self, _s: &S) { }
143+
fn encode(&self, _s: &S) { _s.emit_nil() }
144144
}
145145

146146
impl<D:Decoder> Decodable<D> for span {

branches/try/src/libsyntax/ext/pipes/liveness.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pub fn analyze(proto: protocol, _cx: @ext_ctxt) {
6363
debug!("colive iteration %?", i);
6464
let mut new_colive = ~[];
6565
for colive.eachi |i, this_colive| {
66-
let mut result = this_colive.clone();
66+
let mut result = ~this_colive.clone();
6767
let this = proto.get_state_by_id(i);
6868
for this_colive.ones |j| {
6969
let next = proto.get_state_by_id(j);

branches/try/src/libsyntax/parse/mod.rs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,9 @@ mod test {
297297
use std;
298298
use core::io;
299299
use core::option::None;
300-
use core::str;
301300
use util::testing::*;
302301

303-
#[test] fn to_json_str (val: @Encodable<std::json::Encoder>) -> ~str {
302+
#[test] fn to_json_str<E : Encodable<std::json::Encoder>>(val: @E) -> ~str {
304303
do io::with_str_writer |writer| {
305304
val.encode(~std::json::Encoder(writer));
306305
}
@@ -312,18 +311,18 @@ mod test {
312311
@~"fn foo (x : int) { x; }",
313312
~[],
314313
new_parse_sess(None));
315-
check_equal(to_json_str(@tts as @Encodable<std::json::Encoder>),
316-
~"[[\"tt_tok\",[,[\"IDENT\",[\"fn\",false]]]],\
317-
[\"tt_tok\",[,[\"IDENT\",[\"foo\",false]]]],\
318-
[\"tt_delim\",[[[\"tt_tok\",[,[\"LPAREN\",[]]]],\
319-
[\"tt_tok\",[,[\"IDENT\",[\"x\",false]]]],\
320-
[\"tt_tok\",[,[\"COLON\",[]]]],\
321-
[\"tt_tok\",[,[\"IDENT\",[\"int\",false]]]],\
322-
[\"tt_tok\",[,[\"RPAREN\",[]]]]]]],\
323-
[\"tt_delim\",[[[\"tt_tok\",[,[\"LBRACE\",[]]]],\
324-
[\"tt_tok\",[,[\"IDENT\",[\"x\",false]]]],\
325-
[\"tt_tok\",[,[\"SEMI\",[]]]],\
326-
[\"tt_tok\",[,[\"RBRACE\",[]]]]]]]]"
314+
check_equal(to_json_str(@tts),
315+
~"[[\"tt_tok\",[null,[\"IDENT\",[\"fn\",false]]]],\
316+
[\"tt_tok\",[null,[\"IDENT\",[\"foo\",false]]]],\
317+
[\"tt_delim\",[[[\"tt_tok\",[null,[\"LPAREN\",[]]]],\
318+
[\"tt_tok\",[null,[\"IDENT\",[\"x\",false]]]],\
319+
[\"tt_tok\",[null,[\"COLON\",[]]]],\
320+
[\"tt_tok\",[null,[\"IDENT\",[\"int\",false]]]],\
321+
[\"tt_tok\",[null,[\"RPAREN\",[]]]]]]],\
322+
[\"tt_delim\",[[[\"tt_tok\",[null,[\"LBRACE\",[]]]],\
323+
[\"tt_tok\",[null,[\"IDENT\",[\"x\",false]]]],\
324+
[\"tt_tok\",[null,[\"SEMI\",[]]]],\
325+
[\"tt_tok\",[null,[\"RBRACE\",[]]]]]]]]"
327326
);
328327
let ast1 = new_parser_from_tts(new_parse_sess(None),~[],tts)
329328
.parse_item(~[]);

branches/try/src/test/run-pass/alt-value-binding-in-guard-3291.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
fn foo(x: Option<~int>, b: bool) -> int {
1212
match x {
1313
None => { 1 }
14-
Some(ref x) if b => { *x.clone() }
14+
Some(copy x) if b => { *x }
1515
Some(_) => { 0 }
1616
}
1717
}

branches/try/src/test/run-pass/assignability-trait.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub fn main() {
4343
// Call a method
4444
for x.iterate() |y| { fail_unless!(x[*y] == *y); }
4545
// Call a parameterized function
46-
fail_unless!(length(x.clone()) == vec::len(x));
46+
fail_unless!(length(copy x) == vec::len(x));
4747
// Call a parameterized function, with type arguments that require
4848
// a borrow
4949
fail_unless!(length::<int, &[int]>(x) == vec::len(x));

branches/try/src/test/run-pass/block-iter-2.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ fn iter_vec<T>(v: ~[T], f: &fn(&T)) { for v.each |x| { f(x); } }
1515
pub fn main() {
1616
let v = ~[1, 2, 3, 4, 5];
1717
let mut sum = 0;
18-
iter_vec(v.clone(), |i| {
19-
iter_vec(v.clone(), |j| {
18+
iter_vec(copy v, |i| {
19+
iter_vec(copy v, |j| {
2020
sum += *i * *j;
2121
});
2222
});

branches/try/src/test/run-pass/block-vec-map2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ pub fn main() {
1515
vec::map2(~[1, 2, 3, 4, 5],
1616
~[true, false, false, true, true],
1717
|i, b| if *b { -(*i) } else { *i } );
18-
error!(v.clone());
18+
error!(copy v);
1919
fail_unless!((v == ~[-1, 2, 3, -4, -5]));
2020
}

branches/try/src/test/run-pass/borrowck-borrow-from-expr-block.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fn borrow(x: &int, f: &fn(x: &int)) {
1313
}
1414

1515
fn test1(x: @~int) {
16-
do borrow(&*x.clone()) |p| {
16+
do borrow(copy *x) |p| {
1717
let x_a = ptr::addr_of(&(**x));
1818
fail_unless!((x_a as uint) != ptr::to_uint(p));
1919
fail_unless!(unsafe{*x_a} == *p);

0 commit comments

Comments
 (0)