about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-10-03 13:13:21 -0700
committerBrian Anderson <banderson@mozilla.com>2011-10-04 21:35:06 -0700
commit33ee73102df243e4b794b81c2e53ba6f222b2f60 (patch)
tree3686f44823da7052636001cae96c3d63106fd467 /src
parentd91b7b61eff9a9fdf8506f7d1b41fde47071503c (diff)
Remove some redundancy in metadata::creader
Diffstat (limited to 'src')
-rw-r--r--src/comp/driver/rustc.rs8
-rw-r--r--src/comp/metadata/creader.rs17
2 files changed, 12 insertions, 13 deletions
diff --git a/src/comp/driver/rustc.rs b/src/comp/driver/rustc.rs
index 70007240b63..b6e72175e15 100644
--- a/src/comp/driver/rustc.rs
+++ b/src/comp/driver/rustc.rs
@@ -536,8 +536,8 @@ mod test {
             alt getopts::getopts(["--test"], opts()) {
               getopts::success(m) { m }
             };
-        let sessopts = build_session_options("whatever", match);
-        let sess = build_session(sessopts);
+        let sessopts = build_session_options(match);
+        let sess = build_session("whatever", sessopts);
         let cfg = build_configuration(sess, "whatever", "whatever");
         assert (attr::contains_name(cfg, "test"));
     }
@@ -550,8 +550,8 @@ mod test {
             alt getopts::getopts(["--test", "--cfg=test"], opts()) {
               getopts::success(m) { m }
             };
-        let sessopts = build_session_options("whatever", match);
-        let sess = build_session(sessopts);
+        let sessopts = build_session_options(match);
+        let sess = build_session("whatever", sessopts);
         let cfg = build_configuration(sess, "whatever", "whatever");
         let test_items = attr::find_meta_items_by_name(cfg, "test");
         assert (vec::len(test_items) == 1u);
diff --git a/src/comp/metadata/creader.rs b/src/comp/metadata/creader.rs
index 9589a504c47..ccded566cfd 100644
--- a/src/comp/metadata/creader.rs
+++ b/src/comp/metadata/creader.rs
@@ -24,7 +24,6 @@ fn read_crates(sess: session::session, crate: ast::crate) {
     let e =
         @{sess: sess,
           crate_cache: @std::map::new_str_hash::<int>(),
-          library_search_paths: sess.filesearch().lib_search_paths(),
           mutable next_crate_num: 1};
     let v =
         visit::mk_simple_visitor(@{visit_view_item:
@@ -37,7 +36,6 @@ fn read_crates(sess: session::session, crate: ast::crate) {
 type env =
     @{sess: session::session,
       crate_cache: @hashmap<str, int>,
-      library_search_paths: [fs::path],
       mutable next_crate_num: ast::crate_num};
 
 fn visit_view_item(e: env, i: @ast::view_item) {
@@ -109,7 +107,7 @@ fn default_native_lib_naming(sess: session::session, static: bool) ->
 }
 
 fn find_library_crate(sess: session::session, ident: ast::ident,
-                      metas: [@ast::meta_item], library_search_paths: [str])
+                      metas: [@ast::meta_item])
    -> option::t<{ident: str, data: @[u8]}> {
 
     attr::require_unique_names(sess, metas);
@@ -132,10 +130,12 @@ fn find_library_crate(sess: session::session, ident: ast::ident,
 
     let nn = default_native_lib_naming(sess, sess.get_opts().static);
     let x =
-        find_library_crate_aux(nn, crate_name, metas, library_search_paths);
+        find_library_crate_aux(nn, crate_name, metas,
+                               sess.filesearch().lib_search_paths());
     if x != none || sess.get_opts().static { ret x; }
     let nn2 = default_native_lib_naming(sess, true);
-    ret find_library_crate_aux(nn2, crate_name, metas, library_search_paths);
+    ret find_library_crate_aux(nn2, crate_name, metas,
+                               sess.filesearch().lib_search_paths());
 }
 
 fn find_library_crate_aux(nn: {prefix: str, suffix: str}, crate_name: str,
@@ -198,11 +198,11 @@ fn get_metadata_section(filename: str) -> option::t<@[u8]> {
 }
 
 fn load_library_crate(sess: session::session, span: span, ident: ast::ident,
-                      metas: [@ast::meta_item], library_search_paths: [str])
+                      metas: [@ast::meta_item])
    -> {ident: str, data: @[u8]} {
 
 
-    alt find_library_crate(sess, ident, metas, library_search_paths) {
+    alt find_library_crate(sess, ident, metas) {
       some(t) { ret t; }
       none. {
         sess.span_fatal(span, #fmt["can't find crate for '%s'", ident]);
@@ -214,8 +214,7 @@ fn resolve_crate(e: env, ident: ast::ident, metas: [@ast::meta_item],
                  span: span) -> ast::crate_num {
     if !e.crate_cache.contains_key(ident) {
         let cinfo =
-            load_library_crate(e.sess, span, ident, metas,
-                               e.library_search_paths);
+            load_library_crate(e.sess, span, ident, metas);
 
         let cfilename = cinfo.ident;
         let cdata = cinfo.data;