Skip to content

Commit a6f7628

Browse files
committed
Use the existing path when removing the prefix fails. This allows the use of out-of-tree paths to be specified
1 parent 666e714 commit a6f7628

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/bootstrap/step.rs

Lines changed: 3 additions & 1 deletion
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)