@@ -18,7 +18,7 @@ use std::{panic, str};
1818
1919pub ( crate )  use  make:: { BuildDocTestBuilder ,  DocTestBuilder } ; 
2020pub ( crate )  use  markdown:: test as  test_markdown; 
21- use  rustc_data_structures:: fx:: { FxHashMap ,  FxHashSet ,   FxHasher ,  FxIndexMap ,  FxIndexSet } ; 
21+ use  rustc_data_structures:: fx:: { FxHashMap ,  FxHasher ,  FxIndexMap ,  FxIndexSet } ; 
2222use  rustc_errors:: emitter:: HumanReadableErrorType ; 
2323use  rustc_errors:: { ColorConfig ,  DiagCtxtHandle } ; 
2424use  rustc_hir as  hir; 
@@ -589,22 +589,11 @@ fn compile_merged_doctest_and_caller_binary(
589589        format ! ( "doctest_bundle_{edition}" ,  edition = doctest. edition) 
590590    } ; 
591591
592-     // Deduplicate passed -L directory paths, since usually all dependencies will be  in the 
593-     // same directory (e.g. target/debug/deps from Cargo). 
594-     let   mut  seen_search_dirs =  FxHashSet :: default ( ) ; 
592+     for  lib_str  in  & rustdoc_options . lib_strs   { 
593+         runner_compiler . arg ( format ! ( "-L{lib_str}" ) ) ; 
594+     } 
595595    for  extern_str in  & rustdoc_options. extern_strs  { 
596-         if  let  Some ( ( _cratename,  path) )  = extern_str. split_once ( '=' )  { 
597-             // Direct dependencies of the tests themselves are 
598-             // indirect dependencies of the test runner. 
599-             // They need to be in the library search path. 
600-             let  dir = Path :: new ( path) 
601-                 . parent ( ) 
602-                 . filter ( |x| x. components ( ) . count ( )  > 0 ) 
603-                 . unwrap_or ( Path :: new ( "." ) ) ; 
604-             if  seen_search_dirs. insert ( dir)  { 
605-                 runner_compiler. arg ( "-L" ) . arg ( dir) ; 
606-             } 
607-         } 
596+         runner_compiler. arg ( format ! ( "--extern={extern_str}" ) ) ; 
608597    } 
609598    let  output_bundle_file = doctest. test_opts . outdir . path ( ) . join ( format ! ( "lib{base_name}.rlib" ) ) ; 
610599    let  mut  extern_path = std:: ffi:: OsString :: from ( format ! ( "--extern={base_name}=" ) ) ; 
0 commit comments