about summary refs log tree commit diff
path: root/src/librustc/metadata
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2013-05-27 17:45:16 -0700
committerTim Chevalier <chevalier@alum.wellesley.edu>2013-06-01 18:48:07 -0700
commitc120464be07a5d14f10909ea6718c58c3aa911e4 (patch)
treef2b7694316b9ebf41403e786b23245c86179d1d7 /src/librustc/metadata
parent341678b815051717c86cc63a00a5d256bf5b2a35 (diff)
downloadrust-c120464be07a5d14f10909ea6718c58c3aa911e4.tar.gz
rust-c120464be07a5d14f10909ea6718c58c3aa911e4.zip
rustc/rusti/rustpkg: Infer packages from `extern mod` directives
This commit won't be quite as useful until I implement RUST_PATH and
until we change `extern mod` to take a general string instead of
an identifier (#5682 and #6407).

With that said, now if you're using rustpkg and a program contains:

extern mod foo;

rustpkg will attempt to search for `foo`, so that you don't have to
provide a -L directory explicitly. In addition, rustpkg will
actually try to build and install `foo`, unless it's already
installed (specifically, I tested that `extern mod extra;` would
not cause it to try to find source for `extra` and compile it
again).

This is as per #5681.

Incidentally, I changed some driver code to infer the link name
from the crate link_meta attributes. If that change isn't ok, say
something. Also, I changed the addl_lib_search_paths field in the
session options to be an @mut ~[Path] so that it can be modified
after expansion but before later phases.
Diffstat (limited to 'src/librustc/metadata')
-rw-r--r--src/librustc/metadata/filesearch.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/librustc/metadata/filesearch.rs b/src/librustc/metadata/filesearch.rs
index 4dbcd21e8f3..f83d33dcb3c 100644
--- a/src/librustc/metadata/filesearch.rs
+++ b/src/librustc/metadata/filesearch.rs
@@ -35,17 +35,18 @@ pub trait FileSearch {
 
 pub fn mk_filesearch(maybe_sysroot: &Option<@Path>,
                      target_triple: &str,
-                     addl_lib_search_paths: ~[Path])
+                     addl_lib_search_paths: @mut ~[Path])
                   -> @FileSearch {
     struct FileSearchImpl {
         sysroot: @Path,
-        addl_lib_search_paths: ~[Path],
+        addl_lib_search_paths: @mut ~[Path],
         target_triple: ~str
     }
     impl FileSearch for FileSearchImpl {
         fn sysroot(&self) -> @Path { self.sysroot }
         fn for_each_lib_search_path(&self, f: &fn(&Path) -> bool) -> bool {
-            debug!("filesearch: searching additional lib search paths");
+            debug!("filesearch: searching additional lib search paths [%?]",
+                   self.addl_lib_search_paths.len());
             // a little weird
             self.addl_lib_search_paths.each(f);