about summary refs log tree commit diff
path: root/src/bootstrap/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/bootstrap/lib.rs')
-rw-r--r--src/bootstrap/lib.rs37
1 files changed, 22 insertions, 15 deletions
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index 83c270865c0..afd740ce548 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -113,9 +113,8 @@
 //! More documentation can be found in each respective module below, and you can
 //! also check out the `src/bootstrap/README.md` file for more information.
 
-#![deny(warnings)]
-#![allow(stable_features)]
-#![feature(associated_consts)]
+//#![deny(warnings)]
+#![feature(core_intrinsics)]
 
 #[macro_use]
 extern crate build_helper;
@@ -267,6 +266,18 @@ struct Crate {
     bench_step: String,
 }
 
+impl Crate {
+    fn is_local(&self, build: &Build) -> bool {
+        self.path.starts_with(&build.config.src) &&
+        !self.path.to_string_lossy().ends_with("_shim")
+    }
+
+    fn local_path(&self, build: &Build) -> PathBuf {
+        assert!(self.is_local(build));
+        self.path.strip_prefix(&build.config.src).unwrap().into()
+    }
+}
+
 /// The various "modes" of invoking Cargo.
 ///
 /// These entries currently correspond to the various output directories of the
@@ -949,22 +960,18 @@ impl Build {
         }
     }
 
-    /// Get a list of crates from a root crate.
-    ///
-    /// Returns Vec<(crate, path to crate, is_root_crate)>
-    fn crates(&self, root: &str) -> Vec<(Interned<String>, &Path)> {
-        let interned = INTERNER.intern_string(root.to_owned());
+    fn in_tree_crates(&self, root: &str) -> Vec<&Crate> {
         let mut ret = Vec::new();
-        let mut list = vec![interned];
+        let mut list = vec![INTERNER.intern_str(root)];
         let mut visited = HashSet::new();
         while let Some(krate) = list.pop() {
             let krate = &self.crates[&krate];
-            // If we can't strip prefix, then out-of-tree path
-            let path = krate.path.strip_prefix(&self.src).unwrap_or(&krate.path);
-            ret.push((krate.name, path));
-            for dep in &krate.deps {
-                if visited.insert(dep) && dep != "build_helper" {
-                    list.push(*dep);
+            if krate.is_local(self) {
+                ret.push(krate);
+                for dep in &krate.deps {
+                    if visited.insert(dep) && dep != "build_helper" {
+                        list.push(*dep);
+                    }
                 }
             }
         }