@@ -1701,35 +1701,7 @@ fn build_deps_args(
17011701) -> CargoResult < ( ) > {
17021702 let bcx = build_runner. bcx ;
17031703
1704- let mut lib_search_paths = Vec :: new ( ) ;
1705- if build_runner. bcx . gctx . cli_unstable ( ) . build_dir_new_layout {
1706- let mut map = BTreeMap :: new ( ) ;
1707-
1708- // Recursively add all dependency args to rustc process
1709- add_dep_arg ( & mut map, build_runner, unit) ;
1710-
1711- let paths = map. into_iter ( ) . map ( |( _, path) | path) . sorted_unstable ( ) ;
1712-
1713- for path in paths {
1714- let mut deps = OsString :: from ( "dependency=" ) ;
1715- deps. push ( path) ;
1716- lib_search_paths. extend ( [ "-L" . into ( ) , deps] ) ;
1717- }
1718- } else {
1719- let mut deps = OsString :: from ( "dependency=" ) ;
1720- deps. push ( build_runner. files ( ) . deps_dir ( unit) ) ;
1721- lib_search_paths. extend ( [ "-L" . into ( ) , deps] ) ;
1722- }
1723-
1724- // Be sure that the host path is also listed. This'll ensure that proc macro
1725- // dependencies are correctly found (for reexported macros).
1726- if !unit. kind . is_host ( ) {
1727- let mut deps = OsString :: from ( "dependency=" ) ;
1728- deps. push ( build_runner. files ( ) . host_deps ( unit) ) ;
1729- lib_search_paths. extend ( [ "-L" . into ( ) , deps] ) ;
1730- }
1731-
1732- for arg in lib_search_paths {
1704+ for arg in lib_search_paths ( build_runner, unit) ? {
17331705 cmd. arg ( arg) ;
17341706 }
17351707
@@ -1847,6 +1819,42 @@ fn add_custom_flags(
18471819 Ok ( ( ) )
18481820}
18491821
1822+ /// Generate a list of `-L` arguments
1823+ fn lib_search_paths (
1824+ build_runner : & BuildRunner < ' _ , ' _ > ,
1825+ unit : & Unit ,
1826+ ) -> CargoResult < Vec < OsString > > {
1827+ let mut lib_search_paths = Vec :: new ( ) ;
1828+ if build_runner. bcx . gctx . cli_unstable ( ) . build_dir_new_layout {
1829+ let mut map = BTreeMap :: new ( ) ;
1830+
1831+ // Recursively add all dependency args to rustc process
1832+ add_dep_arg ( & mut map, build_runner, unit) ;
1833+
1834+ let paths = map. into_iter ( ) . map ( |( _, path) | path) . sorted_unstable ( ) ;
1835+
1836+ for path in paths {
1837+ let mut deps = OsString :: from ( "dependency=" ) ;
1838+ deps. push ( path) ;
1839+ lib_search_paths. extend ( [ "-L" . into ( ) , deps] ) ;
1840+ }
1841+ } else {
1842+ let mut deps = OsString :: from ( "dependency=" ) ;
1843+ deps. push ( build_runner. files ( ) . deps_dir ( unit) ) ;
1844+ lib_search_paths. extend ( [ "-L" . into ( ) , deps] ) ;
1845+ }
1846+
1847+ // Be sure that the host path is also listed. This'll ensure that proc macro
1848+ // dependencies are correctly found (for reexported macros).
1849+ if !unit. kind . is_host ( ) {
1850+ let mut deps = OsString :: from ( "dependency=" ) ;
1851+ deps. push ( build_runner. files ( ) . host_deps ( unit) ) ;
1852+ lib_search_paths. extend ( [ "-L" . into ( ) , deps] ) ;
1853+ }
1854+
1855+ Ok ( lib_search_paths)
1856+ }
1857+
18501858/// Generates a list of `--extern` arguments.
18511859pub fn extern_args (
18521860 build_runner : & BuildRunner < ' _ , ' _ > ,
0 commit comments