Skip to content

Commit 84b17ef

Browse files
committed
---
yaml --- r: 42948 b: refs/heads/try c: 3140436 h: refs/heads/master v: v3
1 parent 4d72b43 commit 84b17ef

File tree

28 files changed

+88
-108
lines changed

28 files changed

+88
-108
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: 19dfec2aaf746535de1521f68421f9980dbf25de
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2f46b763da2c098913884f101b6d71d69af41b49
5-
refs/heads/try: 9adfa59d8e9432eef84297b6ed5d8f2967b9b8f9
5+
refs/heads/try: 31404364e1b0b05aa854abe436a38a44b902d7f7
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278

branches/try/src/libcore/num/f32.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ pub pure fn to_str_digits(num: f32, dig: uint) -> ~str {
439439

440440
impl f32: to_str::ToStr {
441441
#[inline(always)]
442-
pure fn to_str(&self) -> ~str { to_str_digits(*self, 8) }
442+
pure fn to_str() -> ~str { to_str_digits(self, 8) }
443443
}
444444

445445
impl f32: num::ToStrRadix {

branches/try/src/libcore/num/f64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ pub pure fn to_str_digits(num: f64, dig: uint) -> ~str {
463463

464464
impl f64: to_str::ToStr {
465465
#[inline(always)]
466-
pure fn to_str(&self) -> ~str { to_str_digits(*self, 8) }
466+
pure fn to_str() -> ~str { to_str_digits(self, 8) }
467467
}
468468

469469
impl f64: num::ToStrRadix {

branches/try/src/libcore/num/float.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ pub pure fn to_str_digits(num: float, digits: uint) -> ~str {
206206
207207
impl float: to_str::ToStr {
208208
#[inline(always)]
209-
pure fn to_str(&self) -> ~str { to_str_digits(*self, 8) }
209+
pure fn to_str() -> ~str { to_str_digits(self, 8) }
210210
}
211211
212212
impl float: num::ToStrRadix {

branches/try/src/libcore/num/int-template.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,8 @@ pub pure fn str(i: T) -> ~str { to_str(i) }
287287
288288
impl T : ToStr {
289289
#[inline(always)]
290-
pure fn to_str(&self) -> ~str {
291-
to_str(*self)
290+
pure fn to_str() -> ~str {
291+
to_str(self)
292292
}
293293
}
294294

branches/try/src/libcore/num/uint-template.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ pub pure fn str(i: T) -> ~str { to_str(i) }
249249
250250
impl T : ToStr {
251251
#[inline(always)]
252-
pure fn to_str(&self) -> ~str {
253-
to_str(*self)
252+
pure fn to_str() -> ~str {
253+
to_str(self)
254254
}
255255
}
256256

branches/try/src/libcore/path.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ impl Path {
368368
}
369369

370370
impl PosixPath : ToStr {
371-
pure fn to_str(&self) -> ~str {
371+
pure fn to_str() -> ~str {
372372
let mut s = ~"";
373373
if self.is_absolute {
374374
s += "/";
@@ -531,7 +531,7 @@ impl PosixPath : GenericPath {
531531

532532

533533
impl WindowsPath : ToStr {
534-
pure fn to_str(&self) -> ~str {
534+
pure fn to_str() -> ~str {
535535
let mut s = ~"";
536536
match self.host {
537537
Some(ref h) => { s += "\\\\"; s += *h; }

branches/try/src/libcore/prelude.rs

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,35 @@
1313
/* Reexported core operators */
1414

1515
pub use kinds::{Const, Copy, Owned, Durable};
16-
pub use ops::{Drop};
1716
pub use ops::{Add, Sub, Mul, Div, Modulo, Neg, Not};
1817
pub use ops::{BitAnd, BitOr, BitXor};
18+
pub use ops::{Drop};
1919
pub use ops::{Shl, Shr, Index};
2020
pub use option::{Option, Some, None};
2121
pub use result::{Result, Ok, Err};
2222

2323
/* Reexported types and traits */
2424

25-
pub use path::Path;
25+
pub use clone::Clone;
26+
pub use cmp::{Eq, Ord};
27+
pub use container::{Container, Mutable, Map, Set};
28+
pub use hash::Hash;
29+
pub use iter::{BaseIter, ExtendedIter, EqIter, CopyableIter};
30+
pub use iter::{CopyableOrderedIter, CopyableNonstrictIter, Times};
31+
pub use num::Num;
2632
pub use path::GenericPath;
27-
pub use path::WindowsPath;
33+
pub use path::Path;
2834
pub use path::PosixPath;
29-
30-
pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps};
35+
pub use path::WindowsPath;
36+
pub use pipes::{GenericChan, GenericPort};
37+
pub use ptr::Ptr;
3138
pub use str::{StrSlice, Trimmable};
32-
pub use container::{Container, Mutable};
39+
pub use to_bytes::IterBytes;
40+
pub use to_str::ToStr;
41+
pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps};
3342
pub use vec::{CopyableVector, ImmutableVector};
3443
pub use vec::{ImmutableEqVector, ImmutableCopyableVector};
3544
pub use vec::{OwnedVector, OwnedCopyableVector};
36-
pub use iter::{BaseIter, ExtendedIter, EqIter, CopyableIter};
37-
pub use iter::{CopyableOrderedIter, CopyableNonstrictIter, Times};
38-
pub use container::{Container, Mutable, Map, Set};
39-
pub use pipes::{GenericChan, GenericPort};
40-
41-
pub use num::Num;
42-
pub use ptr::Ptr;
43-
pub use to_str::ToStr;
44-
pub use clone::Clone;
45-
46-
pub use cmp::{Eq, Ord};
47-
pub use hash::Hash;
48-
pub use to_bytes::IterBytes;
4945

5046
/* Reexported modules */
5147

branches/try/src/libcore/to_str.rs

Lines changed: 18 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -22,68 +22,52 @@ use kinds::Copy;
2222
use str;
2323
use vec;
2424

25-
pub trait ToStr {
26-
pure fn to_str(&self) -> ~str;
27-
}
25+
pub trait ToStr { pub pure fn to_str() -> ~str; }
2826

2927
impl bool: ToStr {
3028
#[inline(always)]
31-
pure fn to_str(&self) -> ~str { ::bool::to_str(*self) }
29+
pure fn to_str() -> ~str { ::bool::to_str(self) }
3230
}
3331
impl (): ToStr {
3432
#[inline(always)]
35-
pure fn to_str(&self) -> ~str { ~"()" }
33+
pure fn to_str() -> ~str { ~"()" }
3634
}
3735
impl ~str: ToStr {
3836
#[inline(always)]
39-
pure fn to_str(&self) -> ~str { copy *self }
37+
pure fn to_str() -> ~str { copy self }
4038
}
4139
impl &str: ToStr {
4240
#[inline(always)]
43-
pure fn to_str(&self) -> ~str { ::str::from_slice(*self) }
41+
pure fn to_str() -> ~str { ::str::from_slice(self) }
4442
}
4543
impl @str: ToStr {
4644
#[inline(always)]
47-
pure fn to_str(&self) -> ~str { ::str::from_slice(*self) }
45+
pure fn to_str() -> ~str { ::str::from_slice(self) }
4846
}
4947

50-
impl<A: ToStr, B: ToStr> (A, B): ToStr {
48+
impl<A: ToStr Copy, B: ToStr Copy> (A, B): ToStr {
5149
#[inline(always)]
52-
pure fn to_str(&self) -> ~str {
53-
// FIXME(#4760): this causes an llvm assertion
54-
//let &(ref a, ref b) = self;
55-
match *self {
56-
(ref a, ref b) => {
57-
~"(" + a.to_str() + ~", " + b.to_str() + ~")"
58-
}
59-
}
50+
pure fn to_str() -> ~str {
51+
let (a, b) = self;
52+
~"(" + a.to_str() + ~", " + b.to_str() + ~")"
6053
}
6154
}
62-
impl<A: ToStr, B: ToStr, C: ToStr> (A, B, C): ToStr {
55+
impl<A: ToStr Copy, B: ToStr Copy, C: ToStr Copy> (A, B, C): ToStr {
6356
#[inline(always)]
64-
pure fn to_str(&self) -> ~str {
65-
// FIXME(#4760): this causes an llvm assertion
66-
//let &(ref a, ref b, ref c) = self;
67-
match *self {
68-
(ref a, ref b, ref c) => {
69-
fmt!("(%s, %s, %s)",
70-
(*a).to_str(),
71-
(*b).to_str(),
72-
(*c).to_str()
73-
)
74-
}
75-
}
57+
pure fn to_str() -> ~str {
58+
let (a, b, c) = self;
59+
~"(" + a.to_str() + ~", " + b.to_str() + ~", " + c.to_str() + ~")"
7660
}
7761
}
7862

7963
impl<A: ToStr> ~[A]: ToStr {
8064
#[inline(always)]
81-
pure fn to_str(&self) -> ~str {
65+
pure fn to_str() -> ~str {
8266
unsafe {
8367
// Bleh -- not really unsafe
8468
// push_str and push_char
8569
let mut acc = ~"[", first = true;
86-
for self.each |elt| {
70+
for vec::each(self) |elt| {
8771
unsafe {
8872
if first { first = false; }
8973
else { str::push_str(&mut acc, ~", "); }
@@ -98,11 +82,11 @@ impl<A: ToStr> ~[A]: ToStr {
9882
9983
impl<A: ToStr> @A: ToStr {
10084
#[inline(always)]
101-
pure fn to_str(&self) -> ~str { ~"@" + (**self).to_str() }
85+
pure fn to_str() -> ~str { ~"@" + (*self).to_str() }
10286
}
10387
impl<A: ToStr> ~A: ToStr {
10488
#[inline(always)]
105-
pure fn to_str(&self) -> ~str { ~"~" + (**self).to_str() }
89+
pure fn to_str() -> ~str { ~"~" + (*self).to_str() }
10690
}
10791

10892
#[cfg(test)]

branches/try/src/librustc/middle/liveness.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,11 @@ pub fn check_crate(tcx: ty::ctxt,
222222
}
223223

224224
impl LiveNode: to_str::ToStr {
225-
pure fn to_str(&self) -> ~str { fmt!("ln(%u)", **self) }
225+
pure fn to_str() -> ~str { fmt!("ln(%u)", *self) }
226226
}
227227

228228
impl Variable: to_str::ToStr {
229-
pure fn to_str(&self) -> ~str { fmt!("v(%u)", **self) }
229+
pure fn to_str() -> ~str { fmt!("v(%u)", *self) }
230230
}
231231

232232
// ______________________________________________________________________

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ pub struct EnvValue {
121121
}
122122

123123
pub impl EnvAction {
124-
fn to_str(&self) -> ~str {
125-
match *self {
124+
fn to_str() -> ~str {
125+
match self {
126126
EnvCopy => ~"EnvCopy",
127127
EnvMove => ~"EnvMove",
128128
EnvRef => ~"EnvRef"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ pub impl block {
720720
fn ty_to_str(t: ty::t) -> ~str {
721721
ty_to_str(self.tcx(), t)
722722
}
723-
fn to_str(&self) -> ~str {
723+
fn to_str() -> ~str {
724724
match self.node_info {
725725
Some(node_info) => {
726726
fmt!("[block %d]", node_info.id)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ pub impl DatumBlock {
841841
self.bcx.tcx()
842842
}
843843

844-
fn to_str(&self) -> ~str {
844+
fn to_str() -> ~str {
845845
self.datum.to_str(self.ccx())
846846
}
847847
}

branches/try/src/librustc/middle/ty.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -667,43 +667,43 @@ pub impl TyVid: Vid {
667667
}
668668

669669
pub impl TyVid: ToStr {
670-
pure fn to_str(&self) -> ~str { fmt!("<V%u>", self.to_uint()) }
670+
pure fn to_str() -> ~str { fmt!("<V%u>", self.to_uint()) }
671671
}
672672

673673
pub impl IntVid: Vid {
674674
pure fn to_uint() -> uint { *self }
675675
}
676676

677677
pub impl IntVid: ToStr {
678-
pure fn to_str(&self) -> ~str { fmt!("<VI%u>", self.to_uint()) }
678+
pure fn to_str() -> ~str { fmt!("<VI%u>", self.to_uint()) }
679679
}
680680

681681
pub impl FloatVid: Vid {
682682
pure fn to_uint() -> uint { *self }
683683
}
684684

685685
pub impl FloatVid: ToStr {
686-
pure fn to_str(&self) -> ~str { fmt!("<VF%u>", self.to_uint()) }
686+
pure fn to_str() -> ~str { fmt!("<VF%u>", self.to_uint()) }
687687
}
688688

689689
pub impl RegionVid: Vid {
690690
pure fn to_uint() -> uint { *self }
691691
}
692692

693693
pub impl RegionVid: ToStr {
694-
pure fn to_str(&self) -> ~str { fmt!("%?", self) }
694+
pure fn to_str() -> ~str { fmt!("%?", self) }
695695
}
696696

697697
pub impl FnSig : ToStr {
698-
pure fn to_str(&self) -> ~str {
698+
pure fn to_str() -> ~str {
699699
// grr, without tcx not much we can do.
700700
return ~"(...)";
701701
}
702702
}
703703

704704
pub impl InferTy: ToStr {
705-
pure fn to_str(&self) -> ~str {
706-
match *self {
705+
pure fn to_str() -> ~str {
706+
match self {
707707
TyVar(ref v) => v.to_str(),
708708
IntVar(ref v) => v.to_str(),
709709
FloatVar(ref v) => v.to_str()
@@ -712,8 +712,8 @@ pub impl InferTy: ToStr {
712712
}
713713

714714
pub impl IntVarValue : ToStr {
715-
pure fn to_str(&self) -> ~str {
716-
match *self {
715+
pure fn to_str() -> ~str {
716+
match self {
717717
IntType(ref v) => v.to_str(),
718718
UintType(ref v) => v.to_str(),
719719
}

branches/try/src/libstd/bigint.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ impl BigUint : Ord {
8888
}
8989

9090
impl BigUint : ToStr {
91-
pure fn to_str(&self) -> ~str { self.to_str_radix(10) }
91+
pure fn to_str() -> ~str { self.to_str_radix(10) }
9292
}
9393

9494
impl BigUint : from_str::FromStr {
@@ -605,7 +605,7 @@ impl BigInt : Ord {
605605
}
606606

607607
impl BigInt : ToStr {
608-
pure fn to_str(&self) -> ~str { self.to_str_radix(10) }
608+
pure fn to_str() -> ~str { self.to_str_radix(10) }
609609
}
610610

611611
impl BigInt : from_str::FromStr {

branches/try/src/libstd/bitv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ impl Bitv {
474474
* The resulting string has the same length as `self`, and each
475475
* character is either '0' or '1'.
476476
*/
477-
fn to_str(&self) -> ~str {
477+
fn to_str() -> ~str {
478478
let mut rs = ~"";
479479
for self.each() |i| { if i { rs += ~"1"; } else { rs += ~"0"; } };
480480
rs

branches/try/src/libstd/json.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,11 +1172,11 @@ impl <A: ToJson> Option<A>: ToJson {
11721172
}
11731173
11741174
impl Json: to_str::ToStr {
1175-
pure fn to_str(&self) -> ~str { to_str(self) }
1175+
pure fn to_str() -> ~str { to_str(&self) }
11761176
}
11771177
11781178
impl Error: to_str::ToStr {
1179-
pure fn to_str(&self) -> ~str {
1179+
pure fn to_str() -> ~str {
11801180
fmt!("%u:%u: %s", self.line, self.col, *self.msg)
11811181
}
11821182
}

branches/try/src/libstd/net_url.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -718,8 +718,8 @@ pub pure fn to_str(url: &Url) -> ~str {
718718
}
719719

720720
impl Url: to_str::ToStr {
721-
pub pure fn to_str(&self) -> ~str {
722-
to_str(self)
721+
pub pure fn to_str() -> ~str {
722+
to_str(&self)
723723
}
724724
}
725725

branches/try/src/libstd/oldmap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ pub mod chained {
353353
}
354354

355355
impl<K:Eq IterBytes Hash Copy ToStr, V: ToStr Copy> T<K, V>: ToStr {
356-
pure fn to_str(&self) -> ~str {
356+
pure fn to_str() -> ~str {
357357
unsafe {
358358
// Meh -- this should be safe
359359
do io::with_str_writer |wr| { self.to_writer(wr) }

0 commit comments

Comments
 (0)