@@ -74,22 +74,22 @@ pub fn dylib_env_var() -> &'static str {
7474 }
7575}
7676
77- /// The platform-specific library file extension
78- pub fn lib_extension ( dylib : bool ) -> & ' static str {
77+ /// The platform-specific library name
78+ pub fn get_lib_name ( lib : & str , dylib : bool ) -> String {
7979 // In some casess (e.g. MUSL), we build a static
8080 // library, rather than a dynamic library.
8181 // In this case, the only path we can pass
8282 // with '--extern-meta' is the '.lib' file
8383 if !dylib {
84- return " .rlib"
84+ return format ! ( "lib{} .rlib", lib ) ;
8585 }
8686
8787 if cfg ! ( windows) {
88- " .dll"
88+ format ! ( "{} .dll", lib )
8989 } else if cfg ! ( target_os = "macos" ) {
90- " .dylib"
90+ format ! ( "lib{} .dylib", lib )
9191 } else {
92- " .so"
92+ format ! ( "lib{} .so", lib )
9393 }
9494}
9595
@@ -1608,7 +1608,7 @@ impl<'test> TestCx<'test> {
16081608 let mut extern_priv = self . props . extern_private . clone ( ) ;
16091609
16101610 let mut add_extern_priv = |priv_dep : & str , dylib : bool | {
1611- let lib_name = format ! ( "lib{}{}" , priv_dep, lib_extension ( dylib) ) ;
1611+ let lib_name = get_lib_name ( priv_dep, dylib) ;
16121612 rustc
16131613 . arg ( "--extern-private" )
16141614 . arg ( format ! ( "{}={}" , priv_dep, aux_dir. join( lib_name) . to_str( ) . unwrap( ) ) ) ;
0 commit comments