File tree 1 file changed +8
-3
lines changed
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -663,11 +663,16 @@ fn phase_cargo_runner(binary: &Path, binary_args: env::Args) {
663
663
let json_flag = "--json" ;
664
664
while let Some ( arg) = args. next ( ) {
665
665
if arg == extern_flag {
666
+ cmd. arg ( extern_flag) ; // always forward flag, but adjust filename
666
667
// `--extern` is always passed as a separate argument by cargo.
667
668
let next_arg = args. next ( ) . expect ( "`--extern` should be followed by a filename" ) ;
668
- let next_arg = next_arg. strip_suffix ( ".rlib" ) . expect ( "all extern filenames should end in `.rlib`" ) ;
669
- cmd. arg ( extern_flag) ;
670
- cmd. arg ( format ! ( "{}.rmeta" , next_arg) ) ;
669
+ if let Some ( next_lib) = next_arg. strip_suffix ( ".rlib" ) {
670
+ // If this is an rlib, make it an rmeta.
671
+ cmd. arg ( format ! ( "{}.rmeta" , next_lib) ) ;
672
+ } else {
673
+ // Some other extern file (e.g., a `.so`). Forward unchanged.
674
+ cmd. arg ( next_arg) ;
675
+ }
671
676
} else if arg. starts_with ( error_format_flag) {
672
677
let suffix = & arg[ error_format_flag. len ( ) ..] ;
673
678
assert ! ( suffix. starts_with( '=' ) ) ;
You can’t perform that action at this time.
0 commit comments