Skip to content

Commit 08d8c11

Browse files
committed
---
yaml --- r: 141207 b: refs/heads/try2 c: 248a669 h: refs/heads/master i: 141205: 022ae92 141203: 4fbac0b 141199: 84f81ac v: v3
1 parent 3bddfc6 commit 08d8c11

Some content is hidden

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

78 files changed

+1500
-1573
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: ed9a793d244c42e77e40f18a5f243ff58dec07f7
8+
refs/heads/try2: 248a66938181e67855ac6f330ff626a509611a9b
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/doc/rust.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2435,10 +2435,11 @@ match x {
24352435
}
24362436
~~~~
24372437

2438-
Patterns that bind variables default to binding to a copy of the matched value. This can be made
2439-
explicit using the ```copy``` keyword, changed to bind to a borrowed pointer by using the ```ref```
2440-
keyword, or to a mutable borrowed pointer using ```ref mut```, or the value can be moved into
2441-
the new binding using ```move```.
2438+
Patterns that bind variables default to binding to a copy or move of the matched value
2439+
(depending on the matched value's type).
2440+
This can be made explicit using the ```copy``` keyword,
2441+
changed to bind to a borrowed pointer by using the ```ref``` keyword,
2442+
or to a mutable borrowed pointer using ```ref mut```.
24422443

24432444
A pattern that's just an identifier,
24442445
like `Nil` in the previous answer,

branches/try2/doc/tutorial.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,6 +1480,7 @@ This code creates a closure that adds a given string to its argument,
14801480
returns it from a function, and then calls it:
14811481

14821482
~~~~
1483+
# extern mod std;
14831484
fn mk_appender(suffix: ~str) -> @fn(~str) -> ~str {
14841485
// The compiler knows that we intend this closure to be of type @fn
14851486
return |s| s + suffix;
@@ -2291,7 +2292,7 @@ let nonsense = mycircle.radius() * mycircle.area();
22912292
22922293
## Deriving implementations for traits
22932294

2294-
A small number of traits in `std` and `extra` can have implementations
2295+
A small number of traits in `std` and `std` can have implementations
22952296
that can be automatically derived. These instances are specified by
22962297
placing the `deriving` attribute on a data type declaration. For
22972298
example, the following will mean that `Circle` has an implementation
@@ -2540,9 +2541,9 @@ as well as an inscrutable string of alphanumerics. These are both
25402541
part of Rust's library versioning scheme. The alphanumerics are
25412542
a hash representing the crate metadata.
25422543

2543-
## The standard library
2544+
## The std library
25442545

2545-
The Rust standard library provides runtime features required by the language,
2546+
The Rust std library provides runtime features required by the language,
25462547
including the task scheduler and memory allocators, as well as library
25472548
support for Rust built-in types, platform abstractions, and other commonly
25482549
used features.
@@ -2558,7 +2559,7 @@ I/O abstractions ([`io`]), [containers] like [`hashmap`],
25582559
common traits ([`kinds`], [`ops`], [`cmp`], [`num`],
25592560
[`to_str`], [`clone`]), and complete bindings to the C standard library ([`libc`]).
25602561

2561-
### Standard Library injection and the Rust prelude
2562+
### Core injection and the Rust prelude
25622563

25632564
`std` is imported at the topmost level of every crate by default, as
25642565
if the first line of each crate was
@@ -2570,7 +2571,7 @@ with the `std::` path prefix, as in `use std::vec`, `use std::task::spawn`,
25702571
etc.
25712572

25722573
Additionally, `std` contains a `prelude` module that reexports many of the
2573-
most common standard modules, types and traits. The contents of the prelude are
2574+
most common std modules, types and traits. The contents of the prelude are
25742575
imported into every *module* by default. Implicitly, all modules behave as if
25752576
they contained the following prologue:
25762577

branches/try2/src/compiletest/compiletest.rc

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,20 @@ pub fn main() {
5050

5151
pub fn parse_config(args: ~[~str]) -> config {
5252
let opts =
53-
~[getopts::reqopt("compile-lib-path"),
54-
getopts::reqopt("run-lib-path"),
55-
getopts::reqopt("rustc-path"), getopts::reqopt("src-base"),
56-
getopts::reqopt("build-base"), getopts::reqopt("aux-base"),
57-
getopts::reqopt("stage-id"),
58-
getopts::reqopt("mode"), getopts::optflag("ignored"),
59-
getopts::optopt("runtool"), getopts::optopt("rustcflags"),
60-
getopts::optflag("verbose"),
61-
getopts::optopt("logfile"),
62-
getopts::optflag("jit"),
63-
getopts::optflag("newrt"),
64-
getopts::optopt("target"),
65-
getopts::optopt("adb-path"),
66-
getopts::optopt("adb-test-dir")
53+
~[getopts::reqopt(~"compile-lib-path"),
54+
getopts::reqopt(~"run-lib-path"),
55+
getopts::reqopt(~"rustc-path"), getopts::reqopt(~"src-base"),
56+
getopts::reqopt(~"build-base"), getopts::reqopt(~"aux-base"),
57+
getopts::reqopt(~"stage-id"),
58+
getopts::reqopt(~"mode"), getopts::optflag(~"ignored"),
59+
getopts::optopt(~"runtool"), getopts::optopt(~"rustcflags"),
60+
getopts::optflag(~"verbose"),
61+
getopts::optopt(~"logfile"),
62+
getopts::optflag(~"jit"),
63+
getopts::optflag(~"newrt"),
64+
getopts::optopt(~"target"),
65+
getopts::optopt(~"adb-path"),
66+
getopts::optopt(~"adb-test-dir")
6767
];
6868

6969
assert!(!args.is_empty());
@@ -74,43 +74,43 @@ pub fn parse_config(args: ~[~str]) -> config {
7474
Err(f) => fail!(getopts::fail_str(f))
7575
};
7676

77-
fn opt_path(m: &getopts::Matches, nm: &str) -> Path {
77+
fn opt_path(m: &getopts::Matches, nm: ~str) -> Path {
7878
Path(getopts::opt_str(m, nm))
7979
}
8080

8181
config {
82-
compile_lib_path: getopts::opt_str(matches, "compile-lib-path"),
83-
run_lib_path: getopts::opt_str(matches, "run-lib-path"),
84-
rustc_path: opt_path(matches, "rustc-path"),
85-
src_base: opt_path(matches, "src-base"),
86-
build_base: opt_path(matches, "build-base"),
87-
aux_base: opt_path(matches, "aux-base"),
88-
stage_id: getopts::opt_str(matches, "stage-id"),
89-
mode: str_mode(getopts::opt_str(matches, "mode")),
90-
run_ignored: getopts::opt_present(matches, "ignored"),
82+
compile_lib_path: getopts::opt_str(matches, ~"compile-lib-path"),
83+
run_lib_path: getopts::opt_str(matches, ~"run-lib-path"),
84+
rustc_path: opt_path(matches, ~"rustc-path"),
85+
src_base: opt_path(matches, ~"src-base"),
86+
build_base: opt_path(matches, ~"build-base"),
87+
aux_base: opt_path(matches, ~"aux-base"),
88+
stage_id: getopts::opt_str(matches, ~"stage-id"),
89+
mode: str_mode(getopts::opt_str(matches, ~"mode")),
90+
run_ignored: getopts::opt_present(matches, ~"ignored"),
9191
filter:
9292
if vec::len(matches.free) > 0u {
9393
option::Some(copy matches.free[0])
9494
} else { option::None },
95-
logfile: getopts::opt_maybe_str(matches, "logfile").map(|s| Path(*s)),
96-
runtool: getopts::opt_maybe_str(matches, "runtool"),
97-
rustcflags: getopts::opt_maybe_str(matches, "rustcflags"),
98-
jit: getopts::opt_present(matches, "jit"),
99-
newrt: getopts::opt_present(matches, "newrt"),
100-
target: opt_str2(getopts::opt_maybe_str(matches, "target")).to_str(),
101-
adb_path: opt_str2(getopts::opt_maybe_str(matches, "adb-path")).to_str(),
95+
logfile: getopts::opt_maybe_str(matches, ~"logfile").map(|s| Path(*s)),
96+
runtool: getopts::opt_maybe_str(matches, ~"runtool"),
97+
rustcflags: getopts::opt_maybe_str(matches, ~"rustcflags"),
98+
jit: getopts::opt_present(matches, ~"jit"),
99+
newrt: getopts::opt_present(matches, ~"newrt"),
100+
target: opt_str2(getopts::opt_maybe_str(matches, ~"target")).to_str(),
101+
adb_path: opt_str2(getopts::opt_maybe_str(matches, ~"adb-path")).to_str(),
102102
adb_test_dir:
103-
opt_str2(getopts::opt_maybe_str(matches, "adb-test-dir")).to_str(),
103+
opt_str2(getopts::opt_maybe_str(matches, ~"adb-test-dir")).to_str(),
104104
adb_device_status:
105-
if (opt_str2(getopts::opt_maybe_str(matches, "target")) ==
105+
if (opt_str2(getopts::opt_maybe_str(matches, ~"target")) ==
106106
~"arm-linux-androideabi") {
107-
if (opt_str2(getopts::opt_maybe_str(matches, "adb-test-dir")) !=
107+
if (opt_str2(getopts::opt_maybe_str(matches, ~"adb-test-dir")) !=
108108
~"(none)" &&
109-
opt_str2(getopts::opt_maybe_str(matches, "adb-test-dir")) !=
109+
opt_str2(getopts::opt_maybe_str(matches, ~"adb-test-dir")) !=
110110
~"") { true }
111111
else { false }
112112
} else { false },
113-
verbose: getopts::opt_present(matches, "verbose")
113+
verbose: getopts::opt_present(matches, ~"verbose")
114114
}
115115
}
116116

branches/try2/src/compiletest/header.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ pub fn load_props(testfile: &Path) -> TestProps {
8787

8888
pub fn is_test_ignored(config: &config, testfile: &Path) -> bool {
8989
for iter_header(testfile) |ln| {
90-
if parse_name_directive(ln, "xfail-test") { return true; }
90+
if parse_name_directive(ln, ~"xfail-test") { return true; }
9191
if parse_name_directive(ln, xfail_target()) { return true; }
9292
if config.mode == common::mode_pretty &&
93-
parse_name_directive(ln, "xfail-pretty") { return true; }
93+
parse_name_directive(ln, ~"xfail-pretty") { return true; }
9494
};
9595
return false;
9696

@@ -107,7 +107,8 @@ fn iter_header(testfile: &Path, it: &fn(~str) -> bool) -> bool {
107107
// Assume that any directives will be found before the first
108108
// module or function. This doesn't seem to be an optimization
109109
// with a warm page cache. Maybe with a cold one.
110-
if str::starts_with(ln, "fn") || str::starts_with(ln, "mod") {
110+
if str::starts_with(ln, ~"fn")
111+
|| str::starts_with(ln, ~"mod") {
111112
return false;
112113
} else { if !(it(ln)) { return false; } }
113114
}

branches/try2/src/compiletest/runtest.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use util::logv;
2525
pub fn run(config: config, testfile: ~str) {
2626
if config.verbose {
2727
// We're going to be dumping a lot of info. Start on a new line.
28-
io::stdout().write_str("\n\n");
28+
io::stdout().write_str(~"\n\n");
2929
}
3030
let testfile = Path(testfile);
3131
debug!("running %s", testfile.to_str());
@@ -231,7 +231,7 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
231231
// do not optimize debuginfo tests
232232
let mut config = match config.rustcflags {
233233
Some(ref flags) => config {
234-
rustcflags: Some(str::replace(*flags, "-O", "")),
234+
rustcflags: Some(str::replace(*flags, ~"-O", ~"")),
235235
.. copy *config
236236
},
237237
None => copy *config
@@ -249,19 +249,19 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
249249
// write debugger script
250250
let script_str = str::append(cmds, "\nquit\n");
251251
debug!("script_str = %s", script_str);
252-
dump_output_file(config, testfile, script_str, "debugger.script");
252+
dump_output_file(config, testfile, script_str, ~"debugger.script");
253253

254254
// run debugger script with gdb
255255
#[cfg(windows)]
256256
fn debugger() -> ~str { ~"gdb.exe" }
257257
#[cfg(unix)]
258258
fn debugger() -> ~str { ~"gdb" }
259-
let debugger_script = make_out_name(config, testfile, "debugger.script");
259+
let debugger_script = make_out_name(config, testfile, ~"debugger.script");
260260
let debugger_opts = ~[~"-quiet", ~"-batch", ~"-nx",
261261
~"-command=" + debugger_script.to_str(),
262262
make_exe_name(config, testfile).to_str()];
263263
let ProcArgs = ProcArgs {prog: debugger(), args: debugger_opts};
264-
ProcRes = compose_and_run(config, testfile, ProcArgs, ~[], "", None);
264+
ProcRes = compose_and_run(config, testfile, ProcArgs, ~[], ~"", None);
265265
if ProcRes.status != 0 {
266266
fatal(~"gdb failed to execute");
267267
}
@@ -368,7 +368,7 @@ fn check_expected_errors(expected_errors: ~[errors::ExpectedError],
368368
}
369369

370370
// ignore this msg which gets printed at the end
371-
if str::contains(line, "aborting due to") {
371+
if str::contains(line, ~"aborting due to") {
372372
was_expected = true;
373373
}
374374

@@ -643,7 +643,7 @@ fn program_output(config: &config, testfile: &Path, lib_path: &str, prog: ~str,
643643
#[cfg(target_os = "macos")]
644644
#[cfg(target_os = "freebsd")]
645645
fn make_cmdline(_libpath: &str, prog: &str, args: &[~str]) -> ~str {
646-
fmt!("%s %s", prog, str::connect(args, " "))
646+
fmt!("%s %s", prog, str::connect(args, ~" "))
647647
}
648648
649649
#[cfg(target_os = "win32")]
@@ -668,7 +668,7 @@ fn dump_output_file(config: &config, testfile: &Path,
668668
out: &str, extension: &str) {
669669
let outfile = make_out_name(config, testfile, extension);
670670
let writer =
671-
io::file_writer(&outfile, [io::Create, io::Truncate]).get();
671+
io::file_writer(&outfile, ~[io::Create, io::Truncate]).get();
672672
writer.write_str(out);
673673
}
674674

@@ -692,8 +692,8 @@ fn output_base_name(config: &config, testfile: &Path) -> Path {
692692

693693
fn maybe_dump_to_stdout(config: &config, out: &str, err: &str) {
694694
if config.verbose {
695-
let sep1 = fmt!("------%s------------------------------", "stdout");
696-
let sep2 = fmt!("------%s------------------------------", "stderr");
695+
let sep1 = fmt!("------%s------------------------------", ~"stdout");
696+
let sep2 = fmt!("------%s------------------------------", ~"stderr");
697697
let sep3 = ~"------------------------------------------";
698698
io::stdout().write_line(sep1);
699699
io::stdout().write_line(out);
@@ -781,10 +781,10 @@ fn _arm_exec_compiled_test(config: &config, props: &TestProps,
781781
newargs_err.push(newcmd_err);
782782
783783
let procsrv::Result{ out: out_out, err: _out_err, status: out_status } =
784-
procsrv::run("", config.adb_path, newargs_out, ~[(~"",~"")],
784+
procsrv::run(~"", config.adb_path, newargs_out, ~[(~"",~"")],
785785
Some(~""));
786786
let procsrv::Result{ out: err_out, err: _err_err, status: _err_status } =
787-
procsrv::run("", config.adb_path, newargs_err, ~[(~"",~"")],
787+
procsrv::run(~"", config.adb_path, newargs_err, ~[(~"",~"")],
788788
Some(~""));
789789
790790
dump_output(config, testfile, out_out, err_out);
@@ -818,8 +818,8 @@ fn _arm_push_aux_shared_library(config: &config, testfile: &Path) {
818818
819819
if (file.filetype() == Some(~".so")) {
820820
821-
let copy_result = procsrv::run("", config.adb_path,
822-
[~"push", file.to_str(), copy config.adb_test_dir],
821+
let copy_result = procsrv::run(~"", config.adb_path,
822+
~[~"push", file.to_str(), copy config.adb_test_dir],
823823
~[(~"",~"")], Some(~""));
824824
825825
if config.verbose {

branches/try2/src/libextra/base64.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
1313
use core::prelude::*;
1414

15+
use core::old_iter;
16+
use core::str;
17+
use core::vec;
18+
1519
pub trait ToBase64 {
1620
fn to_base64(&self) -> ~str;
1721
}
@@ -238,12 +242,12 @@ mod tests {
238242
239243
#[test]
240244
fn test_from_base64() {
241-
assert_eq!((~"").from_base64(), str::to_bytes(""));
242-
assert!((~"Zg==").from_base64() == str::to_bytes("f"));
243-
assert_eq!((~"Zm8=").from_base64(), str::to_bytes("fo"));
244-
assert_eq!((~"Zm9v").from_base64(), str::to_bytes("foo"));
245-
assert!((~"Zm9vYg==").from_base64() == str::to_bytes("foob"));
246-
assert_eq!((~"Zm9vYmE=").from_base64(), str::to_bytes("fooba"))
247-
assert_eq!((~"Zm9vYmFy").from_base64(), str::to_bytes("foobar"));
245+
assert_eq!((~"").from_base64(), str::to_bytes(~""));
246+
assert!((~"Zg==").from_base64() == str::to_bytes(~"f"));
247+
assert_eq!((~"Zm8=").from_base64(), str::to_bytes(~"fo"));
248+
assert_eq!((~"Zm9v").from_base64(), str::to_bytes(~"foo"));
249+
assert!((~"Zm9vYg==").from_base64() == str::to_bytes(~"foob"));
250+
assert_eq!((~"Zm9vYmE=").from_base64(), str::to_bytes(~"fooba"))
251+
assert_eq!((~"Zm9vYmFy").from_base64(), str::to_bytes(~"foobar"));
248252
}
249253
}

branches/try2/src/libextra/bitv.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
use core::prelude::*;
1212

13+
use core::vec::from_elem;
14+
1315
struct SmallBitv {
1416
/// only the lowest nbits of this value are used. the rest is undefined.
1517
bits: uint
@@ -255,7 +257,7 @@ pub impl Bitv {
255257
let nelems = nbits/uint::bits +
256258
if nbits % uint::bits == 0 {0} else {1};
257259
let elem = if init {!0} else {0};
258-
let s = vec::from_elem(nelems, elem);
260+
let s = from_elem(nelems, elem);
259261
Big(~BigBitv::new(s))
260262
};
261263
Bitv {rep: rep, nbits: nbits}
@@ -500,7 +502,7 @@ impl Clone for Bitv {
500502
Bitv{nbits: self.nbits, rep: Small(~SmallBitv{bits: b.bits})}
501503
}
502504
Big(ref b) => {
503-
let mut st = vec::from_elem(self.nbits / uint::bits + 1, 0);
505+
let mut st = from_elem(self.nbits / uint::bits + 1, 0);
504506
let len = st.len();
505507
for uint::range(0, len) |i| { st[i] = b.storage[i]; };
506508
Bitv{nbits: self.nbits, rep: Big(~BigBitv{storage: st})}
@@ -870,14 +872,17 @@ mod tests {
870872
871873
#[test]
872874
fn test_0_elements() {
873-
let act = Bitv::new(0u, false);
874-
let exp = vec::from_elem::<uint>(0u, 0u);
875+
let mut act;
876+
let exp;
877+
act = Bitv::new(0u, false);
878+
exp = vec::from_elem::<uint>(0u, 0u);
875879
assert!(act.eq_vec(exp));
876880
}
877881
878882
#[test]
879883
fn test_1_element() {
880-
let mut act = Bitv::new(1u, false);
884+
let mut act;
885+
act = Bitv::new(1u, false);
881886
assert!(act.eq_vec(~[0u]));
882887
act = Bitv::new(1u, true);
883888
assert!(act.eq_vec(~[1u]));
@@ -1483,7 +1488,7 @@ mod tests {
14831488
#[bench]
14841489
fn bench_bitv_big_union(b: &mut BenchHarness) {
14851490
let mut b1 = Bitv::new(bench_bits, false);
1486-
let b2 = Bitv::new(bench_bits, false);
1491+
let mut b2 = Bitv::new(bench_bits, false);
14871492
do b.iter {
14881493
b1.union(&b2);
14891494
}

0 commit comments

Comments
 (0)