Skip to content

Commit a4a756c

Browse files
committed
---
yaml --- r: 95638 b: refs/heads/dist-snap c: 76287cc h: refs/heads/master v: v3
1 parent 5eed191 commit a4a756c

File tree

145 files changed

+5756
-4284
lines changed

Some content is hidden

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

145 files changed

+5756
-4284
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: c274a6888410ce3e357e014568b43310ed787d36
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 3f5b2219cc893b30863f9136703166f306fcc684
9+
refs/heads/dist-snap: 76287ccbb097d9b351657de8f514c5dd7c5955d5
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/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/dist-snap/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/dist-snap/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/dist-snap/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/dist-snap/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/dist-snap/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/dist-snap/src/libextra/arc.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ impl<T:Freeze + Send> Clone for Arc<T> {
148148
* object. However, one of the `arc` objects can be sent to another task,
149149
* allowing them to share the underlying data.
150150
*/
151+
#[inline]
151152
fn clone(&self) -> Arc<T> {
152153
Arc { x: self.x.clone() }
153154
}
@@ -167,6 +168,7 @@ pub struct MutexArc<T> { priv x: UnsafeArc<MutexArcInner<T>> }
167168

168169
impl<T:Send> Clone for MutexArc<T> {
169170
/// Duplicate a mutex-protected Arc. See arc::clone for more details.
171+
#[inline]
170172
fn clone(&self) -> MutexArc<T> {
171173
// NB: Cloning the underlying mutex is not necessary. Its reference
172174
// count would be exactly the same as the shared state's.
@@ -349,6 +351,7 @@ pub struct RWArc<T> {
349351

350352
impl<T:Freeze + Send> Clone for RWArc<T> {
351353
/// Duplicate a rwlock-protected Arc. See arc::clone for more details.
354+
#[inline]
352355
fn clone(&self) -> RWArc<T> {
353356
RWArc { x: self.x.clone() }
354357
}

0 commit comments

Comments
 (0)