Skip to content

Commit

Permalink
Auto merge of #41170 - Nashenas88:master, r=alexcrichton
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors committed Apr 19, 2017
2 parents 84be2df + a6f7628 commit 5f22d46
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/bootstrap/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down

0 comments on commit 5f22d46

Please sign in to comment.