Skip to content

Commit 9891254

Browse files
committed
---
yaml --- r: 146191 b: refs/heads/try2 c: 568576b h: refs/heads/master i: 146189: f34d397 146187: ede68ff 146183: bc60870 146175: aba0be4 v: v3
1 parent 62a437e commit 9891254

File tree

157 files changed

+5913
-4913
lines changed

Some content is hidden

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

157 files changed

+5913
-4913
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: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: baeed886aa64943ad48121cc3b57dabec12bc835
8+
refs/heads/try2: 568576bab035ac1ed769e55c83edb31e427df8bd
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/doc/tutorial-conditions.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ $ ./example numbers.txt
4343

4444
An example program that does this task reads like this:
4545

46-
~~~~{.xfail-test}
46+
~~~~
4747
# #[allow(unused_imports)];
4848
extern mod extra;
4949
use extra::fileinput::FileInput;
@@ -430,7 +430,7 @@ To trap a condition, use `Condition::trap` in some caller of the site that calls
430430
For example, this version of the program traps the `malformed_line` condition
431431
and replaces bad input lines with the pair `(-1,-1)`:
432432

433-
~~~~{.xfail-test}
433+
~~~~
434434
# #[allow(unused_imports)];
435435
extern mod extra;
436436
use extra::fileinput::FileInput;
@@ -507,7 +507,7 @@ In the example program, the first form of the `malformed_line` API implicitly as
507507
This assumption may not be correct; some callers may wish to skip malformed lines, for example.
508508
Changing the condition's return type from `(int,int)` to `Option<(int,int)>` will suffice to support this type of recovery:
509509

510-
~~~~{.xfail-test}
510+
~~~~
511511
# #[allow(unused_imports)];
512512
extern mod extra;
513513
use extra::fileinput::FileInput;
@@ -594,7 +594,7 @@ until all relevant combinations encountered in practice are encoded.
594594
In the example, suppose a third possible recovery form arose: reusing the previous value read.
595595
This can be encoded in the handler API by introducing a helper type: `enum MalformedLineFix`.
596596

597-
~~~~{.xfail-test}
597+
~~~~
598598
# #[allow(unused_imports)];
599599
extern mod extra;
600600
use extra::fileinput::FileInput;
@@ -720,7 +720,7 @@ task <unnamed> failed at 'called `Option::unwrap()` on a `None` value', .../libs
720720
To make the program robust -- or at least flexible -- in the face of this potential failure,
721721
a second condition and a helper function will suffice:
722722

723-
~~~~{.xfail-test}
723+
~~~~
724724
# #[allow(unused_imports)];
725725
extern mod extra;
726726
use extra::fileinput::FileInput;

branches/try2/doc/tutorial-tasks.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ calling the `spawn` function with a closure argument. `spawn` executes the
6969
closure in the new task.
7070

7171
~~~~
72+
# use std::io::println;
7273
# use std::task::spawn;
7374
7475
// Print something profound in a different task using a named function

branches/try2/doc/tutorial.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2907,12 +2907,12 @@ you just have to import it with an `use` statement.
29072907
For example, it re-exports `println` which is defined in `std::io::println`:
29082908

29092909
~~~
2910-
use puts = std::rt::io::stdio::println;
2910+
use puts = std::io::println;
29112911
29122912
fn main() {
29132913
println("println is imported per default.");
29142914
puts("Doesn't hinder you from importing it under an different name yourself.");
2915-
::std::rt::io::stdio::println("Or from not using the automatic import.");
2915+
::std::io::println("Or from not using the automatic import.");
29162916
}
29172917
~~~
29182918

branches/try2/src/compiletest/runtest.rs

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ use util;
2121
use util::logv;
2222

2323
use std::cell::Cell;
24-
use std::rt::io;
25-
use std::rt::io::Writer;
26-
use std::rt::io::extensions::ReaderUtil;
27-
use std::rt::io::file::FileInfo;
24+
use std::io;
2825
use std::os;
2926
use std::str;
3027
use std::task::{spawn_sched, SingleThreaded};
@@ -63,7 +60,7 @@ pub fn run(config: config, testfile: ~str) {
6360
pub fn run_metrics(config: config, testfile: ~str, mm: &mut MetricMap) {
6461
if config.verbose {
6562
// We're going to be dumping a lot of info. Start on a new line.
66-
print!("\n\n");
63+
io::stdout().write_str("\n\n");
6764
}
6865
let testfile = Path::new(testfile);
6966
debug!("running {}", testfile.display());
@@ -173,9 +170,7 @@ fn run_pretty_test(config: &config, props: &TestProps, testfile: &Path) {
173170
let rounds =
174171
match props.pp_exact { Some(_) => 1, None => 2 };
175172

176-
let src = testfile.open_reader(io::Open).read_to_end();
177-
let src = str::from_utf8_owned(src);
178-
let mut srcs = ~[src];
173+
let mut srcs = ~[io::read_whole_file_str(testfile).unwrap()];
179174

180175
let mut round = 0;
181176
while round < rounds {
@@ -195,8 +190,7 @@ fn run_pretty_test(config: &config, props: &TestProps, testfile: &Path) {
195190
let mut expected = match props.pp_exact {
196191
Some(ref file) => {
197192
let filepath = testfile.dir_path().join(file);
198-
let s = filepath.open_reader(io::Open).read_to_end();
199-
str::from_utf8_owned(s)
193+
io::read_whole_file_str(&filepath).unwrap()
200194
}
201195
None => { srcs[srcs.len() - 2u].clone() }
202196
};
@@ -234,7 +228,8 @@ fn run_pretty_test(config: &config, props: &TestProps, testfile: &Path) {
234228
fn compare_source(expected: &str, actual: &str) {
235229
if expected != actual {
236230
error(~"pretty-printed source does not match expected source");
237-
println!("\n\
231+
let msg =
232+
format!("\n\
238233
expected:\n\
239234
------------------------------------------\n\
240235
{}\n\
@@ -245,6 +240,7 @@ actual:\n\
245240
------------------------------------------\n\
246241
\n",
247242
expected, actual);
243+
io::stdout().write_str(msg);
248244
fail!();
249245
}
250246
}
@@ -745,7 +741,9 @@ fn dump_output(config: &config, testfile: &Path, out: &str, err: &str) {
745741
fn dump_output_file(config: &config, testfile: &Path,
746742
out: &str, extension: &str) {
747743
let outfile = make_out_name(config, testfile, extension);
748-
outfile.open_writer(io::CreateOrTruncate).write(out.as_bytes());
744+
let writer =
745+
io::file_writer(&outfile, [io::Create, io::Truncate]).unwrap();
746+
writer.write_str(out);
749747
}
750748

751749
fn make_out_name(config: &config, testfile: &Path, extension: &str) -> Path {
@@ -773,20 +771,24 @@ fn output_base_name(config: &config, testfile: &Path) -> Path {
773771

774772
fn maybe_dump_to_stdout(config: &config, out: &str, err: &str) {
775773
if config.verbose {
776-
println!("------{}------------------------------", "stdout");
777-
println!("{}", out);
778-
println!("------{}------------------------------", "stderr");
779-
println!("{}", err);
780-
println!("------------------------------------------");
774+
let sep1 = format!("------{}------------------------------", "stdout");
775+
let sep2 = format!("------{}------------------------------", "stderr");
776+
let sep3 = ~"------------------------------------------";
777+
io::stdout().write_line(sep1);
778+
io::stdout().write_line(out);
779+
io::stdout().write_line(sep2);
780+
io::stdout().write_line(err);
781+
io::stdout().write_line(sep3);
781782
}
782783
}
783784
784-
fn error(err: ~str) { println!("\nerror: {}", err); }
785+
fn error(err: ~str) { io::stdout().write_line(format!("\nerror: {}", err)); }
785786

786787
fn fatal(err: ~str) -> ! { error(err); fail!(); }
787788

788789
fn fatal_ProcRes(err: ~str, ProcRes: &ProcRes) -> ! {
789-
print!("\n\
790+
let msg =
791+
format!("\n\
790792
error: {}\n\
791793
command: {}\n\
792794
stdout:\n\
@@ -799,6 +801,7 @@ stderr:\n\
799801
------------------------------------------\n\
800802
\n",
801803
err, ProcRes.cmdline, ProcRes.stdout, ProcRes.stderr);
804+
io::stdout().write_str(msg);
802805
fail!();
803806
}
804807

@@ -818,9 +821,9 @@ fn _arm_exec_compiled_test(config: &config, props: &TestProps,
818821
~[(~"",~"")], Some(~""));
819822

820823
if config.verbose {
821-
println!("push ({}) {} {} {}",
824+
io::stdout().write_str(format!("push ({}) {} {} {}",
822825
config.target, args.prog,
823-
copy_result.out, copy_result.err);
826+
copy_result.out, copy_result.err));
824827
}
825828

826829
logv(config, format!("executing ({}) {}", config.target, cmdline));
@@ -910,9 +913,9 @@ fn _arm_push_aux_shared_library(config: &config, testfile: &Path) {
910913
~[(~"",~"")], Some(~""));
911914

912915
if config.verbose {
913-
println!("push ({}) {} {} {}",
916+
io::stdout().write_str(format!("push ({}) {} {} {}",
914917
config.target, file.display(),
915-
copy_result.out, copy_result.err);
918+
copy_result.out, copy_result.err));
916919
}
917920
}
918921
}
@@ -996,8 +999,7 @@ fn disassemble_extract(config: &config, _props: &TestProps,
996999

9971000

9981001
fn count_extracted_lines(p: &Path) -> uint {
999-
let x = p.with_extension("ll").open_reader(io::Open).read_to_end();
1000-
let x = str::from_utf8_owned(x);
1002+
let x = io::read_whole_file_str(&p.with_extension("ll")).unwrap();
10011003
x.line_iter().len()
10021004
}
10031005

branches/try2/src/compiletest/util.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
use common::config;
1212

13+
use std::io;
1314
use std::os::getenv;
1415

1516
/// Conversion table from triple OS name to Rust SYSNAME
@@ -63,5 +64,5 @@ pub fn path_div() -> ~str { ~";" }
6364
6465
pub fn logv(config: &config, s: ~str) {
6566
debug!("{}", s);
66-
if config.verbose { println(s); }
67+
if config.verbose { io::println(s); }
6768
}

branches/try2/src/etc/combine-tests.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,15 @@ def scrub(b):
5656
d.write("extern mod extra;\n")
5757
d.write("extern mod run_pass_stage2;\n")
5858
d.write("use run_pass_stage2::*;\n")
59-
d.write("use std::rt::io;\n");
60-
d.write("use std::rt::io::Writer;\n");
59+
d.write("use std::io::WriterUtil;\n");
60+
d.write("use std::io;\n");
6161
d.write("fn main() {\n");
62-
d.write(" let mut out = io::stdout();\n");
62+
d.write(" let out = io::stdout();\n");
6363
i = 0
6464
for t in stage2_tests:
6565
p = os.path.join("test", "run-pass", t)
6666
p = p.replace("\\", "\\\\")
67-
d.write(" out.write(\"run-pass [stage2]: %s\\n\".as_bytes());\n" % p)
67+
d.write(" out.write_str(\"run-pass [stage2]: %s\\n\");\n" % p)
6868
d.write(" t_%d::main();\n" % i)
6969
i += 1
7070
d.write("}\n")

branches/try2/src/libextra/arc.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,10 @@ pub struct Arc<T> { priv x: UnsafeArc<T> }
117117
*/
118118
impl<T:Freeze+Send> Arc<T> {
119119
/// Create an atomically reference counted wrapper.
120-
#[inline]
121120
pub fn new(data: T) -> Arc<T> {
122121
Arc { x: UnsafeArc::new(data) }
123122
}
124123

125-
#[inline]
126124
pub fn get<'a>(&'a self) -> &'a T {
127125
unsafe { &*self.x.get_immut() }
128126
}
@@ -150,7 +148,6 @@ impl<T:Freeze + Send> Clone for Arc<T> {
150148
* object. However, one of the `arc` objects can be sent to another task,
151149
* allowing them to share the underlying data.
152150
*/
153-
#[inline]
154151
fn clone(&self) -> Arc<T> {
155152
Arc { x: self.x.clone() }
156153
}
@@ -170,7 +167,6 @@ pub struct MutexArc<T> { priv x: UnsafeArc<MutexArcInner<T>> }
170167

171168
impl<T:Send> Clone for MutexArc<T> {
172169
/// Duplicate a mutex-protected Arc. See arc::clone for more details.
173-
#[inline]
174170
fn clone(&self) -> MutexArc<T> {
175171
// NB: Cloning the underlying mutex is not necessary. Its reference
176172
// count would be exactly the same as the shared state's.
@@ -353,7 +349,6 @@ pub struct RWArc<T> {
353349

354350
impl<T:Freeze + Send> Clone for RWArc<T> {
355351
/// Duplicate a rwlock-protected Arc. See arc::clone for more details.
356-
#[inline]
357352
fn clone(&self) -> RWArc<T> {
358353
RWArc { x: self.x.clone() }
359354
}

branches/try2/src/libextra/comm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ pub fn rendezvous<T: Send>() -> (SyncPort<T>, SyncChan<T>) {
136136
#[cfg(test)]
137137
mod test {
138138
use comm::{DuplexStream, rendezvous};
139-
use std::rt::test::run_in_uv_task;
139+
use std::rt::test::run_in_newsched_task;
140140
use std::task::spawn_unlinked;
141141

142142

@@ -165,7 +165,7 @@ mod test {
165165
#[test]
166166
fn recv_a_lot() {
167167
// Rendezvous streams should be able to handle any number of messages being sent
168-
do run_in_uv_task {
168+
do run_in_newsched_task {
169169
let (port, chan) = rendezvous();
170170
do spawn {
171171
do 1000000.times { chan.send(()) }

0 commit comments

Comments
 (0)