Skip to content

Commit 5d180b8

Browse files
committed
---
yaml --- r: 80718 b: refs/heads/try c: 45c62c0 h: refs/heads/master v: v3
1 parent d5e9aaf commit 5d180b8

File tree

17 files changed

+29
-68
lines changed

17 files changed

+29
-68
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: 4c6bf4872012c010f84dc7fa2cdfe87522533f89
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cbd1eefbd350797b783df119fed7956d7e1c74ad
5-
refs/heads/try: 19c07352319e1953bdff52618a540dd915a0abbd
5+
refs/heads/try: 45c62c08f9740dfcdf64c64c8b183acfc22fb3d6
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/compiletest/compiletest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ pub fn make_test_name(config: &config, testfile: &Path) -> test::TestName {
309309
let filename = path.filename();
310310
let p = path.pop();
311311
let dir = p.filename();
312-
fmt!("%s/%s", dir.unwrap_or_default(""), filename.unwrap_or_default(""))
312+
fmt!("%s/%s", dir.unwrap_or(""), filename.unwrap_or(""))
313313
}
314314

315315
test::DynTestName(fmt!("[%s] %s",

branches/try/src/libextra/glob.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ impl Pattern {
312312
let require_literal = |c| {
313313
(options.require_literal_separator && is_sep(c)) ||
314314
(options.require_literal_leading_dot && c == '.'
315-
&& is_sep(prev_char.unwrap_or_default('/')))
315+
&& is_sep(prev_char.unwrap_or('/')))
316316
};
317317
318318
for (ti, token) in self.tokens.slice_from(i).iter().enumerate() {

branches/try/src/librustc/driver/driver.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -681,9 +681,9 @@ pub fn build_session_options(binary: @str,
681681
link::output_type_bitcode
682682
} else { link::output_type_exe };
683683
let sysroot_opt = getopts::opt_maybe_str(matches, "sysroot").map_move(|m| @Path(m));
684-
let target = getopts::opt_maybe_str(matches, "target").unwrap_or_default(host_triple());
685-
let target_cpu = getopts::opt_maybe_str(matches, "target-cpu").unwrap_or_default(~"generic");
686-
let target_feature = getopts::opt_maybe_str(matches, "target-feature").unwrap_or_default(~"");
684+
let target = getopts::opt_maybe_str(matches, "target").unwrap_or(host_triple());
685+
let target_cpu = getopts::opt_maybe_str(matches, "target-cpu").unwrap_or(~"generic");
686+
let target_feature = getopts::opt_maybe_str(matches, "target-feature").unwrap_or(~"");
687687
let save_temps = getopts::opt_present(matches, "save-temps");
688688
let opt_level = {
689689
if (debugging_opts & session::no_opt) != 0 {

branches/try/src/librustc/middle/privacy.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,7 @@ impl PrivacyVisitor {
221221
// If the method is a default method, we need to use the def_id of
222222
// the default implementation.
223223
// Having to do this this is really unfortunate.
224-
let method_id = ty::method(self.tcx, method_id).provided_source
225-
.unwrap_or_default(method_id);
224+
let method_id = ty::method(self.tcx, method_id).provided_source.unwrap_or(method_id);
226225

227226
if method_id.crate == LOCAL_CRATE {
228227
let is_private = self.method_is_private(span, method_id.node);

branches/try/src/librustc/middle/typeck/check/_match.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ pub fn check_pat_variant(pcx: &pat_ctxt, pat: @ast::Pat, path: &ast::Path,
173173
fcx.write_error(pat.id);
174174
kind_name = "[error]";
175175
arg_types = (*subpats).clone()
176-
.unwrap_or_default(~[])
176+
.unwrap_or(~[])
177177
.map(|_| ty::mk_err());
178178
}
179179
}
@@ -222,7 +222,7 @@ pub fn check_pat_variant(pcx: &pat_ctxt, pat: @ast::Pat, path: &ast::Path,
222222
fcx.write_error(pat.id);
223223
kind_name = "[error]";
224224
arg_types = (*subpats).clone()
225-
.unwrap_or_default(~[])
225+
.unwrap_or(~[])
226226
.map(|_| ty::mk_err());
227227
}
228228
}

branches/try/src/librustdoc/attr_pass.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ fn fold_crate(
6868
doc::CrateDoc {
6969
topmod: doc::ModDoc {
7070
item: doc::ItemDoc {
71-
name: attrs.name.clone().unwrap_or_default(doc.topmod.name_()),
71+
name: attrs.name.clone().unwrap_or(doc.topmod.name_()),
7272
.. doc.topmod.item.clone()
7373
},
7474
.. doc.topmod.clone()

branches/try/src/librustdoc/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ fn config_from_opts(
142142
let output_dir = getopts::opt_maybe_str(matches, opt_output_dir());
143143
let output_dir = output_dir.map_move(|s| Path(s));
144144
result::Ok(Config {
145-
output_dir: output_dir.unwrap_or_default(config.output_dir.clone()),
145+
output_dir: output_dir.unwrap_or(config.output_dir.clone()),
146146
.. config
147147
})
148148
};

branches/try/src/librustpkg/path_util.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@ pub fn workspace_contains_package_id(pkgid: &PkgId, workspace: &Path) -> bool {
5555
pub fn workspace_contains_package_id_(pkgid: &PkgId, workspace: &Path,
5656
// Returns the directory it was actually found in
5757
workspace_to_src_dir: &fn(&Path) -> Path) -> Option<Path> {
58-
if !os::path_is_dir(workspace) {
59-
return None;
60-
}
61-
6258
let src_dir = workspace_to_src_dir(workspace);
6359

6460
let mut found = None;

branches/try/src/librustpkg/rustpkg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use rustc::metadata::filesearch::rust_path;
3333
use extra::{getopts};
3434
use syntax::{ast, diagnostic};
3535
use util::*;
36-
use messages::{error, warn, note};
36+
use messages::*;
3737
use path_util::build_pkg_id_in_workspace;
3838
use path_util::{U_RWX, in_rust_path};
3939
use path_util::{built_executable_in_workspace, built_library_in_workspace, default_workspace};

branches/try/src/librustpkg/tests.rs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,28 +1581,6 @@ fn pkgid_pointing_to_subdir() {
15811581
assert_executable_exists(&workspace, "testpkg");
15821582
}
15831583

1584-
fn test_recursive_deps() {
1585-
let a_id = PkgId::new("a");
1586-
let b_id = PkgId::new("b");
1587-
let c_id = PkgId::new("c");
1588-
let b_workspace = create_local_package_with_dep(&b_id, &c_id);
1589-
writeFile(&b_workspace.push("src").push("c-0.1").push("lib.rs"),
1590-
"pub fn g() {}");
1591-
let a_workspace = create_local_package(&a_id);
1592-
writeFile(&a_workspace.push("src").push("a-0.1").push("main.rs"),
1593-
"extern mod b; use b::f; fn main() { f(); }");
1594-
writeFile(&b_workspace.push("src").push("b-0.1").push("lib.rs"),
1595-
"extern mod c; use c::g; pub fn f() { g(); }");
1596-
let environment = Some(~[(~"RUST_PATH", b_workspace.to_str())]);
1597-
debug!("RUST_PATH=%s", b_workspace.to_str());
1598-
command_line_test_with_env([~"install", ~"a"],
1599-
&a_workspace,
1600-
environment);
1601-
assert_lib_exists(&a_workspace, &Path("a"), NoVersion);
1602-
assert_lib_exists(&b_workspace, &Path("b"), NoVersion);
1603-
assert_lib_exists(&b_workspace, &Path("c"), NoVersion);
1604-
}
1605-
16061584
/// Returns true if p exists and is executable
16071585
fn is_executable(p: &Path) -> bool {
16081586
use std::libc::consts::os::posix88::{S_IXUSR};

branches/try/src/librustpkg/util.rs

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ use rustc::driver::session::{lib_crate, bin_crate};
2222
use context::{in_target, StopBefore, Link, Assemble, BuildContext};
2323
use package_id::PkgId;
2424
use package_source::PkgSrc;
25-
use workspace::pkg_parent_workspaces;
26-
use path_util::{installed_library_in_workspace, U_RWX, rust_path};
27-
use messages::error;
25+
use path_util::{installed_library_in_workspace, U_RWX};
2826

2927
pub use target::{OutputType, Main, Lib, Bench, Test};
3028
use workcache_support::{digest_file_with_date, digest_only_date};
@@ -245,7 +243,9 @@ pub fn compile_input(context: &BuildContext,
245243
let mut crate = driver::phase_1_parse_input(sess, cfg.clone(), &input);
246244
crate = driver::phase_2_configure_and_expand(sess, cfg.clone(), crate);
247245

248-
find_and_install_dependencies(context, pkg_id, sess, exec, crate,
246+
// Not really right. Should search other workspaces too, and the installed
247+
// database (which doesn't exist yet)
248+
find_and_install_dependencies(context, sess, exec, workspace, crate,
249249
|p| {
250250
debug!("a dependency: %s", p.to_str());
251251
// Pass the directory containing a dependency
@@ -362,15 +362,13 @@ pub fn compile_crate(ctxt: &BuildContext,
362362
/// Collect all `extern mod` directives in `c`, then
363363
/// try to install their targets, failing if any target
364364
/// can't be found.
365-
pub fn find_and_install_dependencies(context: &BuildContext,
366-
parent: &PkgId,
365+
pub fn find_and_install_dependencies(ctxt: &BuildContext,
367366
sess: session::Session,
368367
exec: &mut workcache::Exec,
368+
workspace: &Path,
369369
c: &ast::Crate,
370370
save: @fn(Path)
371371
) {
372-
use conditions::nonexistent_package::cond;
373-
374372
do c.each_view_item() |vi: &ast::view_item| {
375373
debug!("A view item!");
376374
match vi.node {
@@ -381,7 +379,7 @@ pub fn find_and_install_dependencies(context: &BuildContext,
381379
None => sess.str_of(lib_ident)
382380
};
383381
debug!("Finding and installing... %s", lib_name);
384-
match installed_library_in_workspace(&Path(lib_name), &context.sysroot()) {
382+
match installed_library_in_workspace(&Path(lib_name), &ctxt.sysroot()) {
385383
Some(ref installed_path) => {
386384
debug!("It exists: %s", installed_path.to_str());
387385
// Say that [path for c] has a discovered dependency on
@@ -399,18 +397,8 @@ pub fn find_and_install_dependencies(context: &BuildContext,
399397
lib_name.to_str());
400398
// Try to install it
401399
let pkg_id = PkgId::new(lib_name);
402-
let workspaces = pkg_parent_workspaces(&context.context, &pkg_id);
403-
let dep_workspace = if workspaces.is_empty() {
404-
error(fmt!("Couldn't find package %s, which is needed by %s, \
405-
in any of the workspaces in the RUST_PATH (%?)",
406-
lib_name, parent.to_str(), rust_path()));
407-
cond.raise((pkg_id.clone(), ~"Dependency not found"))
408-
}
409-
else {
410-
workspaces[0]
411-
};
412400
let (outputs_disc, inputs_disc) =
413-
context.install(PkgSrc::new(dep_workspace.clone(), false, pkg_id));
401+
ctxt.install(PkgSrc::new(workspace.clone(), false, pkg_id));
414402
debug!("Installed %s, returned %? dependencies and \
415403
%? transitive dependencies",
416404
lib_name, outputs_disc.len(), inputs_disc.len());
@@ -435,7 +423,7 @@ pub fn find_and_install_dependencies(context: &BuildContext,
435423
// Also, add an additional search path
436424
debug!("Adding additional search path: %s", lib_name);
437425
let installed_library =
438-
installed_library_in_workspace(&Path(lib_name), &dep_workspace)
426+
installed_library_in_workspace(&Path(lib_name), workspace)
439427
.expect( fmt!("rustpkg failed to install dependency %s",
440428
lib_name));
441429
let install_dir = installed_library.pop();

branches/try/src/libstd/at_vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub fn capacity<T>(v: @[T]) -> uint {
4545
#[inline]
4646
pub fn build<A>(size: Option<uint>, builder: &fn(push: &fn(v: A))) -> @[A] {
4747
let mut vec = @[];
48-
unsafe { raw::reserve(&mut vec, size.unwrap_or_default(4)); }
48+
unsafe { raw::reserve(&mut vec, size.unwrap_or(4)); }
4949
builder(|x| unsafe { raw::push(&mut vec, x) });
5050
vec
5151
}

branches/try/src/libstd/option.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ impl<T> Option<T> {
332332

333333
/// Returns the contained value or a default
334334
#[inline]
335-
pub fn unwrap_or_default(self, def: T) -> T {
335+
pub fn unwrap_or(self, def: T) -> T {
336336
match self {
337337
Some(x) => x,
338338
None => def

branches/try/src/libstd/os.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ pub fn tmpdir() -> Path {
611611
if cfg!(target_os = "android") {
612612
Path("/data/tmp")
613613
} else {
614-
getenv_nonempty("TMPDIR").unwrap_or_default(Path("/tmp"))
614+
getenv_nonempty("TMPDIR").unwrap_or(Path("/tmp"))
615615
}
616616
}
617617

branches/try/src/libstd/vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ pub fn with_capacity<T>(capacity: uint) -> ~[T] {
205205
*/
206206
#[inline]
207207
pub fn build<A>(size: Option<uint>, builder: &fn(push: &fn(v: A))) -> ~[A] {
208-
let mut vec = with_capacity(size.unwrap_or_default(4));
208+
let mut vec = with_capacity(size.unwrap_or(4));
209209
builder(|x| vec.push(x));
210210
vec
211211
}

branches/try/src/libsyntax/parse/parser.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ impl Parser {
802802
*/
803803

804804
let opt_abis = self.parse_opt_abis();
805-
let abis = opt_abis.unwrap_or_default(AbiSet::Rust());
805+
let abis = opt_abis.unwrap_or(AbiSet::Rust());
806806
let purity = self.parse_unsafety();
807807
self.expect_keyword(keywords::Fn);
808808
let (decl, lifetimes) = self.parse_ty_fn_decl();
@@ -3461,7 +3461,7 @@ impl Parser {
34613461
let ident = self.parse_ident();
34623462
let opt_bounds = self.parse_optional_ty_param_bounds();
34633463
// For typarams we don't care about the difference b/w "<T>" and "<T:>".
3464-
let bounds = opt_bounds.unwrap_or_default(opt_vec::Empty);
3464+
let bounds = opt_bounds.unwrap_or(opt_vec::Empty);
34653465
ast::TyParam { ident: ident, id: ast::DUMMY_NODE_ID, bounds: bounds }
34663466
}
34673467

@@ -4363,7 +4363,7 @@ impl Parser {
43634363
self.obsolete(*self.last_span, ObsoleteExternVisibility);
43644364
}
43654365

4366-
let abis = opt_abis.unwrap_or_default(AbiSet::C());
4366+
let abis = opt_abis.unwrap_or(AbiSet::C());
43674367

43684368
let (inner, next) = self.parse_inner_attrs_and_next();
43694369
let m = self.parse_foreign_mod_items(sort, abis, next);
@@ -4640,7 +4640,7 @@ impl Parser {
46404640

46414641
if self.eat_keyword(keywords::Fn) {
46424642
// EXTERN FUNCTION ITEM
4643-
let abis = opt_abis.unwrap_or_default(AbiSet::C());
4643+
let abis = opt_abis.unwrap_or(AbiSet::C());
46444644
let (ident, item_, extra_attrs) =
46454645
self.parse_item_fn(extern_fn, abis);
46464646
return iovi_item(self.mk_item(lo, self.last_span.hi, ident,

0 commit comments

Comments
 (0)