Skip to content

Commit 5f22d46

Browse files
committed
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.
2 parents 84be2df + a6f7628 commit 5f22d46

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/bootstrap/step.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,9 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
137137
while let Some(krate) = list.pop() {
138138
let default = krate == name;
139139
let krate = &build.crates[krate];
140-
let path = krate.path.strip_prefix(&build.src).unwrap();
140+
let path = krate.path.strip_prefix(&build.src)
141+
// This handles out of tree paths
142+
.unwrap_or(&krate.path);
141143
ret.push((krate, path.to_str().unwrap(), default));
142144
for dep in krate.deps.iter() {
143145
if visited.insert(dep) && dep != "build_helper" {

0 commit comments

Comments
 (0)