@@ -295,7 +295,7 @@ pub fn load_link(mis: ~[@ast::meta_item]) -> (Option<~str>,
295
295
_ => { }
296
296
}
297
297
}
298
- _ => die !(~"load_link: meta items must be name-values")
298
+ _ => fail !(~"load_link: meta items must be name-values")
299
299
}
300
300
}
301
301
(name, vers, uuid)
@@ -332,7 +332,7 @@ pub fn load_crate(filename: &Path) -> Option<Crate> {
332
332
}
333
333
}
334
334
_ => {
335
- die !(~"crate attributes may not contain " +
335
+ fail !(~"crate attributes may not contain " +
336
336
~"meta_words");
337
337
}
338
338
}
@@ -435,7 +435,7 @@ pub fn rest(s: ~str, start: uint) -> ~str {
435
435
pub fn need_dir(s: &Path) {
436
436
if os::path_is_dir(s) { return; }
437
437
if !os::make_dir(s, 493_i32 /* oct: 755 */) {
438
- die !(fmt!("can't make_dir %s", s.to_str()));
438
+ fail !(fmt!("can't make_dir %s", s.to_str()));
439
439
}
440
440
}
441
441
@@ -453,14 +453,14 @@ pub fn valid_pkg_name(s: &str) -> bool {
453
453
454
454
pub fn parse_source(name: ~str, j: &json::Json) -> @Source {
455
455
if !valid_pkg_name(name) {
456
- die !(fmt!("'%s' is an invalid source name", name));
456
+ fail !(fmt!("'%s' is an invalid source name", name));
457
457
}
458
458
459
459
match *j {
460
460
json::Object(ref j) => {
461
461
let mut url = match j.find(&~"url") {
462
462
Some(&json::String(u)) => copy u,
463
- _ => die !(~"needed 'url' field in source")
463
+ _ => fail !(~"needed 'url' field in source")
464
464
};
465
465
let method = match j.find(&~"method") {
466
466
Some(&json::String(u)) => copy u,
@@ -485,7 +485,7 @@ pub fn parse_source(name: ~str, j: &json::Json) -> @Source {
485
485
mut keyfp: keyfp,
486
486
packages: DVec() };
487
487
}
488
- _ => die !(~"needed dict value in source")
488
+ _ => fail !(~"needed dict value in source")
489
489
};
490
490
}
491
491
@@ -500,8 +500,8 @@ pub fn try_parse_sources(filename: &Path,
500
500
debug!("source: %s", *k);
501
501
}
502
502
}
503
- Ok(_) => die !(~"malformed sources.json"),
504
- Err(e) => die !(fmt!("%s:%s", filename.to_str(), e.to_str()))
503
+ Ok(_) => fail !(~"malformed sources.json"),
504
+ Err(e) => fail !(fmt!("%s:%s", filename.to_str(), e.to_str()))
505
505
}
506
506
}
507
507
@@ -662,7 +662,7 @@ pub fn build_cargo_options(argv: ~[~str]) -> Options {
662
662
let matches = &match getopts::getopts(argv, opts()) {
663
663
result::Ok(m) => m,
664
664
result::Err(f) => {
665
- die !(fmt!("%s", getopts::fail_str(f)));
665
+ fail !(fmt!("%s", getopts::fail_str(f)));
666
666
}
667
667
};
668
668
@@ -675,10 +675,10 @@ pub fn build_cargo_options(argv: ~[~str]) -> Options {
675
675
let is_install = len > 1u && matches.free[1] == ~"install";
676
676
let is_uninstall = len > 1u && matches.free[1] == ~"uninstall";
677
677
678
- if G && g { die !(~"-G and -g both provided"); }
678
+ if G && g { fail !(~"-G and -g both provided"); }
679
679
680
680
if !is_install && !is_uninstall && (g || G) {
681
- die !(~"-g and -G are only valid for `install` and `uninstall|rm`");
681
+ fail !(~"-g and -G are only valid for `install` and `uninstall|rm`");
682
682
}
683
683
684
684
let mode =
@@ -845,7 +845,7 @@ pub fn install_source(c: &mut Cargo, path: &Path) {
845
845
}
846
846
847
847
if vec::is_empty(cratefiles) {
848
- die !(~"this doesn't look like a rust package (no .rc files)");
848
+ fail !(~"this doesn't look like a rust package (no .rc files)");
849
849
}
850
850
851
851
for cratefiles.each |cf| {
@@ -889,7 +889,7 @@ pub fn install_curl(c: &mut Cargo, wd: &Path, url: ~str) {
889
889
let p = run::program_output(~"curl", ~[~"-f", ~"-s", ~"-o",
890
890
tarpath.to_str(), url]);
891
891
if p.status != 0 {
892
- die !(fmt!("fetch of %s failed: %s", url, p.err));
892
+ fail !(fmt!("fetch of %s failed: %s", url, p.err));
893
893
}
894
894
run::run_program(~"tar", ~[~"-x", ~"--strip-components=1",
895
895
~"-C", wd.to_str(),
@@ -1123,7 +1123,7 @@ pub fn install_query(c: &mut Cargo, wd: &Path, target: ~str) {
1123
1123
pub fn get_temp_workdir(c: &Cargo) -> Path {
1124
1124
match tempfile::mkdtemp(&c.workdir, "cargo") {
1125
1125
Some(wd) => wd,
1126
- None => die !(fmt!("needed temp dir: %s",
1126
+ None => fail !(fmt!("needed temp dir: %s",
1127
1127
c.workdir.to_str()))
1128
1128
}
1129
1129
}
@@ -1138,7 +1138,7 @@ pub fn cmd_install(c: &mut Cargo) {
1138
1138
wd.to_str()]);
1139
1139
1140
1140
if status != 0 {
1141
- die !(fmt!("could not copy directory: %s", cwd.to_str()));
1141
+ fail !(fmt!("could not copy directory: %s", cwd.to_str()));
1142
1142
}
1143
1143
1144
1144
install_source(c, &wd);
0 commit comments