Skip to content

Commit e36c1b8

Browse files
authored
Fix failed path lookup for newly-transitive deps
1 parent bcdcb6b commit e36c1b8

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/librustdoc/doctest.rs

+12
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,18 @@ fn run_test(
667667
"--extern=rustdoc_tests_merged_{edition}=",
668668
edition = doctest.edition
669669
));
670+
for extern_str in &rustdoc_options.extern_strs {
671+
if let Some((_cratename, path)) = extern_str.split_once('=') {
672+
// Direct dependencies of the tests themselves are
673+
// indirect dependencies of the test runner.
674+
// They need to be in the library search path.
675+
let dir = Path::new(path)
676+
.parent()
677+
.filter(|x| x.components().count() > 0)
678+
.unwrap_or(Path::new("."));
679+
compiler_runner.arg("-L").arg(dir);
680+
}
681+
}
670682
extern_path.push(&output_bundle_file);
671683
compiler_runner.arg(extern_path);
672684
compiler_runner.arg(&runner_input_file);

0 commit comments

Comments
 (0)