about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-04-19 05:54:23 +0000
committerbors <bors@rust-lang.org>2017-04-19 05:54:23 +0000
commit5f22d46e4bea4b5a335c671c61c96f00a5b3f554 (patch)
tree6f01ad3daede6d5ba7803d83d1cb512314e3acba /src
parent84be2df0e9dac63a4e730c4f5652deb872060ad8 (diff)
parenta6f7628ea28a74e09002e430609b6e6ce52fd0ba (diff)
downloadrust-5f22d46e4bea4b5a335c671c61c96f00a5b3f554.tar.gz
rust-5f22d46e4bea4b5a335c671c61c96f00a5b3f554.zip
Auto merge of #41170 - Nashenas88:master, r=alexcrichton
Use the existing path when removing the prefix fails

This allows the use of out-of-tree paths to be specified. I found this while trying to build with a modified version of `rls-data`, which is currently pointing to a version on crates.io.

cc @alexcrichton

Also, it wasn't clear if I needed to add a test for this (or how). I didn't see any tests that took paths into consideration.
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/step.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/bootstrap/step.rs b/src/bootstrap/step.rs
index 34705040e8a..17902a39df1 100644
--- a/src/bootstrap/step.rs
+++ b/src/bootstrap/step.rs
@@ -137,7 +137,9 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
         while let Some(krate) = list.pop() {
             let default = krate == name;
             let krate = &build.crates[krate];
-            let path = krate.path.strip_prefix(&build.src).unwrap();
+            let path = krate.path.strip_prefix(&build.src)
+                // This handles out of tree paths
+                .unwrap_or(&krate.path);
             ret.push((krate, path.to_str().unwrap(), default));
             for dep in krate.deps.iter() {
                 if visited.insert(dep) && dep != "build_helper" {