Skip to content

Commit 0735dfc

Browse files
committed
---
yaml --- r: 102123 b: refs/heads/master c: b78b749 h: refs/heads/master i: 102121: 1937b26 102119: d5c1e91 v: v3
1 parent f6f6252 commit 0735dfc

Some content is hidden

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

97 files changed

+1259
-1332
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: a5342d5970d57dd0cc4805ba0f5385d7f3859c94
2+
refs/heads/master: b78b749810f4ed53e8287adfb284f9f32f16b73c
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 6e7f170fedd3c526a643c0b2d13863acd982be02
55
refs/heads/try: a97642026c18a624ff6ea01075dd9550f8ed07ff

trunk/src/compiletest/procsrv.rs

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
// except according to those terms.
1010

1111
use std::os;
12+
use std::run;
1213
use std::str;
13-
use std::io::process::{ProcessExit, Process, ProcessConfig, ProcessOutput};
14+
use std::io::process::ProcessExit;
1415

1516
#[cfg(target_os = "win32")]
1617
fn target_env(lib_path: &str, prog: &str) -> ~[(~str,~str)] {
@@ -48,19 +49,17 @@ pub fn run(lib_path: &str,
4849
input: Option<~str>) -> Option<Result> {
4950

5051
let env = env + target_env(lib_path, prog);
51-
let mut opt_process = Process::configure(ProcessConfig {
52-
program: prog,
53-
args: args,
54-
env: Some(env.as_slice()),
55-
.. ProcessConfig::new()
52+
let mut opt_process = run::Process::new(prog, args, run::ProcessOptions {
53+
env: Some(env),
54+
.. run::ProcessOptions::new()
5655
});
5756

5857
match opt_process {
5958
Ok(ref mut process) => {
6059
for input in input.iter() {
61-
process.stdin.get_mut_ref().write(input.as_bytes()).unwrap();
60+
process.input().write(input.as_bytes()).unwrap();
6261
}
63-
let ProcessOutput { status, output, error } = process.wait_with_output();
62+
let run::ProcessOutput { status, output, error } = process.finish_with_output();
6463

6564
Some(Result {
6665
status: status,
@@ -76,20 +75,18 @@ pub fn run_background(lib_path: &str,
7675
prog: &str,
7776
args: &[~str],
7877
env: ~[(~str, ~str)],
79-
input: Option<~str>) -> Option<Process> {
78+
input: Option<~str>) -> Option<run::Process> {
8079

8180
let env = env + target_env(lib_path, prog);
82-
let opt_process = Process::configure(ProcessConfig {
83-
program: prog,
84-
args: args,
85-
env: Some(env.as_slice()),
86-
.. ProcessConfig::new()
81+
let opt_process = run::Process::new(prog, args, run::ProcessOptions {
82+
env: Some(env),
83+
.. run::ProcessOptions::new()
8784
});
8885

8986
match opt_process {
9087
Ok(mut process) => {
9188
for input in input.iter() {
92-
process.stdin.get_mut_ref().write(input.as_bytes()).unwrap();
89+
process.input().write(input.as_bytes()).unwrap();
9390
}
9491

9592
Some(process)

trunk/src/compiletest/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
360360
stdout: out,
361361
stderr: err,
362362
cmdline: cmdline};
363-
process.signal_kill().unwrap();
363+
process.force_destroy().unwrap();
364364
}
365365

366366
_=> {

trunk/src/doc/tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2519,7 +2519,7 @@ of type `ABC` can be randomly generated and converted to a string:
25192519
#[deriving(Eq)]
25202520
struct Circle { radius: f64 }
25212521
2522-
#[deriving(Rand, ToStr)]
2522+
#[deriving(Rand, Show)]
25232523
enum ABC { A, B, C }
25242524
~~~
25252525

trunk/src/libcollections/btree.rs

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
///a length (the height of the tree), and lower and upper bounds on the
1919
///number of elements that a given node can contain.
2020
21-
use std::vec::OwnedVector;
21+
use std::fmt;
22+
use std::fmt::Show;
2223

2324
#[allow(missing_doc)]
2425
pub struct BTree<K, V> {
@@ -106,11 +107,10 @@ impl<K: TotalOrd, V: TotalEq> TotalOrd for BTree<K, V> {
106107
}
107108
}
108109

109-
impl<K: ToStr + TotalOrd, V: ToStr> ToStr for BTree<K, V> {
110+
impl<K: fmt::Show + TotalOrd, V: fmt::Show> fmt::Show for BTree<K, V> {
110111
///Returns a string representation of the BTree
111-
fn to_str(&self) -> ~str {
112-
let ret = self.root.to_str();
113-
ret
112+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
113+
self.root.fmt(f)
114114
}
115115
}
116116

@@ -235,15 +235,15 @@ impl<K: TotalOrd, V: TotalEq> TotalOrd for Node<K, V> {
235235
}
236236
}
237237

238-
impl<K: ToStr + TotalOrd, V: ToStr> ToStr for Node<K, V> {
238+
impl<K: fmt::Show + TotalOrd, V: fmt::Show> fmt::Show for Node<K, V> {
239239
///Returns a string representation of a Node.
240240
///Will iterate over the Node and show "Key: x, value: y, child: () // "
241241
///for all elements in the Node. "Child" only exists if the Node contains
242242
///a branch.
243-
fn to_str(&self) -> ~str {
243+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
244244
match *self {
245-
LeafNode(ref leaf) => leaf.to_str(),
246-
BranchNode(ref branch) => branch.to_str()
245+
LeafNode(ref leaf) => leaf.fmt(f),
246+
BranchNode(ref branch) => branch.fmt(f),
247247
}
248248
}
249249
}
@@ -401,10 +401,14 @@ impl<K: TotalOrd, V: TotalEq> TotalOrd for Leaf<K, V> {
401401
}
402402

403403

404-
impl<K: ToStr + TotalOrd, V: ToStr> ToStr for Leaf<K, V> {
404+
impl<K: fmt::Show + TotalOrd, V: fmt::Show> fmt::Show for Leaf<K, V> {
405405
///Returns a string representation of a Leaf.
406-
fn to_str(&self) -> ~str {
407-
self.elts.iter().map(|s| s.to_str()).to_owned_vec().connect(" // ")
406+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
407+
for (i, s) in self.elts.iter().enumerate() {
408+
if i != 0 { if_ok!(write!(f.buf, " // ")) }
409+
if_ok!(write!(f.buf, "{}", *s))
410+
}
411+
Ok(())
408412
}
409413
}
410414

@@ -618,13 +622,14 @@ impl<K: TotalOrd, V: TotalEq> TotalOrd for Branch<K, V> {
618622
}
619623
}
620624

621-
impl<K: ToStr + TotalOrd, V: ToStr> ToStr for Branch<K, V> {
625+
impl<K: fmt::Show + TotalOrd, V: fmt::Show> fmt::Show for Branch<K, V> {
622626
///Returns a string representation of a Branch.
623-
fn to_str(&self) -> ~str {
624-
let mut ret = self.elts.iter().map(|s| s.to_str()).to_owned_vec().connect(" // ");
625-
ret.push_str(" // ");
626-
ret.push_str("rightmost child: ("+ self.rightmost_child.to_str() +") ");
627-
ret
627+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
628+
for (i, s) in self.elts.iter().enumerate() {
629+
if i != 0 { if_ok!(write!(f.buf, " // ")) }
630+
if_ok!(write!(f.buf, "{}", *s))
631+
}
632+
write!(f.buf, " // rightmost child: ({}) ", *self.rightmost_child)
628633
}
629634
}
630635

@@ -672,11 +677,10 @@ impl<K: TotalOrd, V: TotalEq> TotalOrd for LeafElt<K, V> {
672677
}
673678
}
674679

675-
impl<K: ToStr + TotalOrd, V: ToStr> ToStr for LeafElt<K, V> {
680+
impl<K: fmt::Show + TotalOrd, V: fmt::Show> fmt::Show for LeafElt<K, V> {
676681
///Returns a string representation of a LeafElt.
677-
fn to_str(&self) -> ~str {
678-
format!("Key: {}, value: {};",
679-
self.key.to_str(), self.value.to_str())
682+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
683+
write!(f.buf, "Key: {}, value: {};", self.key, self.value)
680684
}
681685
}
682686

@@ -715,12 +719,12 @@ impl<K: TotalOrd, V: TotalEq> TotalOrd for BranchElt<K, V> {
715719
}
716720
}
717721

718-
impl<K: ToStr + TotalOrd, V: ToStr> ToStr for BranchElt<K, V> {
719-
///Returns string containing key, value, and child (which should recur to a leaf)
720-
///Consider changing in future to be more readable.
721-
fn to_str(&self) -> ~str {
722-
format!("Key: {}, value: {}, (child: {})",
723-
self.key.to_str(), self.value.to_str(), self.left.to_str())
722+
impl<K: fmt::Show + TotalOrd, V: fmt::Show> fmt::Show for BranchElt<K, V> {
723+
/// Returns string containing key, value, and child (which should recur to a
724+
/// leaf) Consider changing in future to be more readable.
725+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
726+
write!(f.buf, "Key: {}, value: {}, (child: {})",
727+
self.key, self.value, *self.left)
724728
}
725729
}
726730

trunk/src/libcollections/enum_set.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
1616
use std::num::Bitwise;
1717

18-
#[deriving(Clone, Eq, Hash, ToStr, Encodable, Decodable)]
18+
#[deriving(Clone, Eq, Hash, Show, Encodable, Decodable)]
1919
/// A specialized Set implementation to use enum types.
2020
pub struct EnumSet<E> {
2121
// We must maintain the invariant that no bits are set

trunk/src/libcollections/hashmap.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -606,10 +606,6 @@ impl<A: fmt::Show + Hash + Eq, B: fmt::Show> fmt::Show for HashMap<A, B> {
606606
}
607607
}
608608

609-
impl<K: fmt::Show + Hash + Eq, V: fmt::Show> ToStr for HashMap<K, V> {
610-
fn to_str(&self) -> ~str { format!("{}", *self) }
611-
}
612-
613609
/// HashMap iterator
614610
#[deriving(Clone)]
615611
pub struct Entries<'a, K, V> {
@@ -888,10 +884,6 @@ impl<A: fmt::Show + Hash + Eq> fmt::Show for HashSet<A> {
888884
}
889885
}
890886

891-
impl<A: fmt::Show + Hash + Eq> ToStr for HashSet<A> {
892-
fn to_str(&self) -> ~str { format!("{}", *self) }
893-
}
894-
895887
impl<K: Eq + Hash> FromIterator<K> for HashSet<K> {
896888
fn from_iterator<T: Iterator<K>>(iter: &mut T) -> HashSet<K> {
897889
let (lower, _) = iter.size_hint();

trunk/src/libcollections/lru_cache.rs

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@
3737
//! assert!(cache.get(&2).is_none());
3838
//! ```
3939
40+
use std::cast;
4041
use std::container::Container;
4142
use std::hash::{Hash, sip};
43+
use std::fmt;
4244
use std::ptr;
43-
use std::cast;
4445

4546
use HashMap;
4647

@@ -217,36 +218,32 @@ impl<K: Hash + Eq, V> LruCache<K, V> {
217218
}
218219
}
219220

220-
impl<A: ToStr + Hash + Eq, B: ToStr> ToStr for LruCache<A, B> {
221+
impl<A: fmt::Show + Hash + Eq, B: fmt::Show> fmt::Show for LruCache<A, B> {
221222
/// Return a string that lists the key-value pairs from most-recently
222223
/// used to least-recently used.
223-
#[inline]
224-
fn to_str(&self) -> ~str {
225-
let mut acc = ~"{";
224+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
225+
if_ok!(write!(f.buf, r"\{"));
226226
let mut cur = self.head;
227227
for i in range(0, self.len()) {
228-
if i > 0 {
229-
acc.push_str(", ");
230-
}
228+
if i > 0 { if_ok!(write!(f.buf, ", ")) }
231229
unsafe {
232230
cur = (*cur).next;
233231
match (*cur).key {
234232
// should never print nil
235-
None => acc.push_str("nil"),
236-
Some(ref k) => acc.push_str(k.to_str())
233+
None => if_ok!(write!(f.buf, "nil")),
234+
Some(ref k) => if_ok!(write!(f.buf, "{}", *k)),
237235
}
238236
}
239-
acc.push_str(": ");
237+
if_ok!(write!(f.buf, ": "));
240238
unsafe {
241239
match (*cur).value {
242240
// should never print nil
243-
None => acc.push_str("nil"),
244-
Some(ref value) => acc.push_str(value.to_str())
241+
None => if_ok!(write!(f.buf, "nil")),
242+
Some(ref value) => if_ok!(write!(f.buf, "{}", *value)),
245243
}
246244
}
247245
}
248-
acc.push_char('}');
249-
acc
246+
write!(f.buf, r"\}")
250247
}
251248
}
252249

trunk/src/libextra/json.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ use std::io;
240240
use std::io::MemWriter;
241241
use std::num;
242242
use std::str;
243-
use std::to_str;
243+
use std::fmt;
244244

245245
use serialize::Encodable;
246246
use serialize;
@@ -1576,18 +1576,16 @@ impl<A:ToJson> ToJson for Option<A> {
15761576
}
15771577
}
15781578

1579-
impl to_str::ToStr for Json {
1579+
impl fmt::Show for Json {
15801580
/// Encodes a json value into a string
1581-
fn to_str(&self) -> ~str {
1582-
let mut s = MemWriter::new();
1583-
self.to_writer(&mut s as &mut io::Writer).unwrap();
1584-
str::from_utf8_owned(s.unwrap()).unwrap()
1581+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1582+
self.to_writer(f.buf)
15851583
}
15861584
}
15871585

1588-
impl to_str::ToStr for Error {
1589-
fn to_str(&self) -> ~str {
1590-
format!("{}:{}: {}", self.line, self.col, self.msg)
1586+
impl fmt::Show for Error {
1587+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1588+
write!(f.buf, "{}:{}: {}", self.line, self.col, self.msg)
15911589
}
15921590
}
15931591

0 commit comments

Comments
 (0)