Skip to content

Commit 0ecf259

Browse files
committed
---
yaml --- r: 28111 b: refs/heads/try c: 0c6e470 h: refs/heads/master i: 28109: 7b2c69a 28107: 969d0dd 28103: fea3e44 28095: 18fc6ff v: v3
1 parent 31cc925 commit 0ecf259

Some content is hidden

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

53 files changed

+846
-846
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: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
5-
refs/heads/try: 3a1582012eafb8b672e15b12b5424e72ea6096af
5+
refs/heads/try: 0c6e470a257fc546555aa10ededded4a77460a71
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df

branches/try/src/cargo/cargo.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import rustc::metadata::filesearch::{get_cargo_root, get_cargo_root_nearest,
77
get_cargo_sysroot, libdir};
88
import syntax::diagnostic;
99

10-
import result::{ok, err};
10+
import result::{Ok, Err};
1111
import io::WriterUtil;
1212
import std::{map, json, tempfile, term, sort, getopts};
1313
import map::hashmap;
@@ -429,14 +429,14 @@ fn try_parse_sources(filename: &Path, sources: map::hashmap<~str, source>) {
429429
if !os::path_exists(filename) { return; }
430430
let c = io::read_whole_file_str(filename);
431431
match json::from_str(result::get(c)) {
432-
ok(json::dict(j)) => {
432+
Ok(json::dict(j)) => {
433433
for j.each |k, v| {
434434
sources.insert(k, parse_source(k, v));
435435
debug!("source: %s", k);
436436
}
437437
}
438-
ok(_) => fail ~"malformed sources.json",
439-
err(e) => fail fmt!("%s:%s", filename.to_str(), e.to_str())
438+
Ok(_) => fail ~"malformed sources.json",
439+
Err(e) => fail fmt!("%s:%s", filename.to_str(), e.to_str())
440440
}
441441
}
442442

@@ -548,17 +548,17 @@ fn load_source_info(c: cargo, src: source) {
548548
if !os::path_exists(&srcfile) { return; }
549549
let srcstr = io::read_whole_file_str(&srcfile);
550550
match json::from_str(result::get(srcstr)) {
551-
ok(json::dict(s)) => {
551+
Ok(json::dict(s)) => {
552552
let o = parse_source(src.name, json::dict(s));
553553

554554
src.key = o.key;
555555
src.keyfp = o.keyfp;
556556
}
557-
ok(_) => {
557+
Ok(_) => {
558558
warn(~"malformed source.json: " + src.name +
559559
~"(source info is not a dict)");
560560
}
561-
err(e) => {
561+
Err(e) => {
562562
warn(fmt!("%s:%s", src.name, e.to_str()));
563563
}
564564
};
@@ -570,7 +570,7 @@ fn load_source_packages(c: cargo, src: source) {
570570
if !os::path_exists(&pkgfile) { return; }
571571
let pkgstr = io::read_whole_file_str(&pkgfile);
572572
match json::from_str(result::get(pkgstr)) {
573-
ok(json::list(js)) => {
573+
Ok(json::list(js)) => {
574574
for (*js).each |j| {
575575
match j {
576576
json::dict(p) => {
@@ -583,20 +583,20 @@ fn load_source_packages(c: cargo, src: source) {
583583
}
584584
}
585585
}
586-
ok(_) => {
586+
Ok(_) => {
587587
warn(~"malformed packages.json: " + src.name +
588588
~"(packages is not a list)");
589589
}
590-
err(e) => {
590+
Err(e) => {
591591
warn(fmt!("%s:%s", src.name, e.to_str()));
592592
}
593593
};
594594
}
595595

596596
fn build_cargo_options(argv: ~[~str]) -> options {
597597
let matches = match getopts::getopts(argv, opts()) {
598-
result::ok(m) => m,
599-
result::err(f) => {
598+
result::Ok(m) => m,
599+
result::Err(f) => {
600600
fail fmt!("%s", getopts::fail_str(f));
601601
}
602602
};
@@ -626,8 +626,8 @@ fn build_cargo_options(argv: ~[~str]) -> options {
626626

627627
fn configure(opts: options) -> cargo {
628628
let home = match get_cargo_root() {
629-
ok(home) => home,
630-
err(_err) => result::get(get_cargo_sysroot())
629+
Ok(home) => home,
630+
Err(_err) => result::get(get_cargo_sysroot())
631631
};
632632

633633
let get_cargo_dir = match opts.mode {
@@ -1571,7 +1571,7 @@ fn dump_sources(c: cargo) {
15711571
}
15721572

15731573
match io::buffered_file_writer(&out) {
1574-
result::ok(writer) => {
1574+
result::Ok(writer) => {
15751575
let hash = map::str_hash();
15761576
let root = json::dict(hash);
15771577

@@ -1600,7 +1600,7 @@ fn dump_sources(c: cargo) {
16001600

16011601
writer.write_str(json::to_str(root));
16021602
}
1603-
result::err(e) => {
1603+
result::Err(e) => {
16041604
error(fmt!("could not dump sources: %s", e));
16051605
}
16061606
}

branches/try/src/compiletest/compiletest.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import vec;
66
import task;
77

88
import core::result;
9-
import result::{ok, err};
9+
import result::{Ok, Err};
1010

1111
import common::config;
1212
import common::mode_run_pass;
@@ -38,8 +38,8 @@ fn parse_config(args: ~[~str]) -> config {
3838
let args_ = vec::tail(args);
3939
let matches =
4040
match getopts::getopts(args_, opts) {
41-
ok(m) => m,
42-
err(f) => fail getopts::fail_str(f)
41+
Ok(m) => m,
42+
Err(f) => fail getopts::fail_str(f)
4343
};
4444

4545
fn opt_path(m: getopts::matches, nm: ~str) -> Path {

branches/try/src/libcore/either.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
//! A type that represents one of two alternatives
66
7-
import result::result;
7+
import result::Result;
88

99
/// The either type
1010
enum Either<T, U> {
@@ -83,7 +83,7 @@ pure fn flip<T: copy, U: copy>(eith: &Either<T, U>) -> Either<U, T> {
8383
}
8484
}
8585

86-
pure fn to_result<T: copy, U: copy>(eith: &Either<T, U>) -> result<U, T> {
86+
pure fn to_result<T: copy, U: copy>(eith: &Either<T, U>) -> Result<U, T> {
8787
/*!
8888
* Converts either::t to a result::t
8989
*
@@ -92,8 +92,8 @@ pure fn to_result<T: copy, U: copy>(eith: &Either<T, U>) -> result<U, T> {
9292
*/
9393

9494
match *eith {
95-
Right(r) => result::ok(r),
96-
Left(l) => result::err(l)
95+
Right(r) => result::Ok(r),
96+
Left(l) => result::Err(l)
9797
}
9898
}
9999

branches/try/src/libcore/io.rs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Module: io
44
Basic input/output
55
*/
66

7-
import result::result;
7+
import result::Result;
88

99
import dvec::{DVec, dvec};
1010
import libc::{c_int, c_long, c_uint, c_void, size_t, ssize_t};
@@ -264,16 +264,16 @@ fn FILE_reader(f: *libc::FILE, cleanup: bool) -> Reader {
264264

265265
fn stdin() -> Reader { rustrt::rust_get_stdin() as Reader }
266266

267-
fn file_reader(path: &Path) -> result<Reader, ~str> {
267+
fn file_reader(path: &Path) -> Result<Reader, ~str> {
268268
let f = os::as_c_charp(path.to_str(), |pathbuf| {
269269
os::as_c_charp("r", |modebuf|
270270
libc::fopen(pathbuf, modebuf)
271271
)
272272
});
273-
return if f as uint == 0u { result::err(~"error opening "
273+
return if f as uint == 0u { result::Err(~"error opening "
274274
+ path.to_str()) }
275275
else {
276-
result::ok(FILE_reader(f, true))
276+
result::Ok(FILE_reader(f, true))
277277
}
278278
}
279279
@@ -421,7 +421,7 @@ fn fd_writer(fd: fd_t, cleanup: bool) -> Writer {
421421

422422

423423
fn mk_file_writer(path: &Path, flags: ~[FileFlag])
424-
-> result<Writer, ~str> {
424+
-> Result<Writer, ~str> {
425425

426426
#[cfg(windows)]
427427
fn wb() -> c_int { (O_WRONLY | O_BINARY) as c_int }
@@ -443,10 +443,10 @@ fn mk_file_writer(path: &Path, flags: ~[FileFlag])
443443
(S_IRUSR | S_IWUSR) as c_int)
444444
};
445445
if fd < (0 as c_int) {
446-
result::err(fmt!("error opening %s: %s", path.to_str(),
446+
result::Err(fmt!("error opening %s: %s", path.to_str(),
447447
os::last_os_error()))
448448
} else {
449-
result::ok(fd_writer(fd, true))
449+
result::Ok(fd_writer(fd, true))
450450
}
451451
}
452452

@@ -623,21 +623,21 @@ impl<T: Writer> T : WriterUtil {
623623
fn write_u8(n: u8) { self.write(&[n]) }
624624
}
625625

626-
fn file_writer(path: &Path, flags: ~[FileFlag]) -> result<Writer, ~str> {
627-
result::chain(mk_file_writer(path, flags), |w| result::ok(w))
626+
fn file_writer(path: &Path, flags: ~[FileFlag]) -> Result<Writer, ~str> {
627+
result::chain(mk_file_writer(path, flags), |w| result::Ok(w))
628628
}
629629

630630

631631
// FIXME: fileflags // #2004
632-
fn buffered_file_writer(path: &Path) -> result<Writer, ~str> {
632+
fn buffered_file_writer(path: &Path) -> Result<Writer, ~str> {
633633
let f = do os::as_c_charp(path.to_str()) |pathbuf| {
634634
do os::as_c_charp("w") |modebuf| {
635635
libc::fopen(pathbuf, modebuf)
636636
}
637637
};
638-
return if f as uint == 0u { result::err(~"error opening "
638+
return if f as uint == 0u { result::Err(~"error opening "
639639
+ path.to_str()) }
640-
else { result::ok(FILE_writer(f, true)) }
640+
else { result::Ok(FILE_writer(f, true)) }
641641
}
642642
643643
// FIXME (#2004) it would be great if this could be a const
@@ -719,21 +719,21 @@ fn seek_in_buf(offset: int, pos: uint, len: uint, whence: SeekStyle) ->
719719
return bpos as uint;
720720
}
721721
722-
fn read_whole_file_str(file: &Path) -> result<~str, ~str> {
722+
fn read_whole_file_str(file: &Path) -> Result<~str, ~str> {
723723
result::chain(read_whole_file(file), |bytes| {
724724
if str::is_utf8(bytes) {
725-
result::ok(str::from_bytes(bytes))
725+
result::Ok(str::from_bytes(bytes))
726726
} else {
727-
result::err(file.to_str() + ~" is not UTF-8")
727+
result::Err(file.to_str() + ~" is not UTF-8")
728728
}
729729
})
730730
}
731731

732732
// FIXME (#2004): implement this in a low-level way. Going through the
733733
// abstractions is pointless.
734-
fn read_whole_file(file: &Path) -> result<~[u8], ~str> {
734+
fn read_whole_file(file: &Path) -> Result<~[u8], ~str> {
735735
result::chain(file_reader(file), |rdr| {
736-
result::ok(rdr.read_whole_stream())
736+
result::Ok(rdr.read_whole_stream())
737737
})
738738
}
739739

@@ -892,30 +892,30 @@ mod tests {
892892
#[test]
893893
fn file_reader_not_exist() {
894894
match io::file_reader(&Path("not a file")) {
895-
result::err(e) => {
895+
result::Err(e) => {
896896
assert e == ~"error opening not a file";
897897
}
898-
result::ok(_) => fail
898+
result::Ok(_) => fail
899899
}
900900
}
901901

902902
#[test]
903903
fn file_writer_bad_name() {
904904
match io::file_writer(&Path("?/?"), ~[]) {
905-
result::err(e) => {
905+
result::Err(e) => {
906906
assert str::starts_with(e, "error opening");
907907
}
908-
result::ok(_) => fail
908+
result::Ok(_) => fail
909909
}
910910
}
911911

912912
#[test]
913913
fn buffered_file_writer_bad_name() {
914914
match io::buffered_file_writer(&Path("?/?")) {
915-
result::err(e) => {
915+
result::Err(e) => {
916916
assert str::starts_with(e, "error opening");
917917
}
918-
result::ok(_) => fail
918+
result::Ok(_) => fail
919919
}
920920
}
921921

0 commit comments

Comments
 (0)