@@ -417,7 +417,7 @@ fn driver() -> anyhow::Result<()> {
417
417
inkwell:: targets:: RelocMode :: PIC ,
418
418
inkwell:: targets:: CodeModel :: Small
419
419
) . expect ( "failed to create target machine" ) ;
420
- let output = ( input != "-" ) . then ( || output . map ( String :: from ) . unwrap_or_else ( || match emit {
420
+ let mut output = output . map ( String :: from ) . or_else ( || ( input != "-" ) . then ( || match emit {
421
421
OutputType :: Executable => format ! ( "{}{}" , input. rfind( '.' ) . map_or( input. as_str( ) , |i| & input[ ..i] ) , if triple. contains( "windows" ) { ".exe" } else { "" } ) ,
422
422
OutputType :: Library => libs:: format_lib ( input. rfind ( '.' ) . map_or ( input. as_str ( ) , |i| & input[ ..i] ) , & trip) ,
423
423
OutputType :: Object => format ! ( "{}.o" , input. rfind( '.' ) . map_or( input. as_str( ) , |i| & input[ ..i] ) ) ,
@@ -427,6 +427,7 @@ fn driver() -> anyhow::Result<()> {
427
427
OutputType :: Header => format ! ( "{}.coh" , input. rfind( '.' ) . map_or( input. as_str( ) , |i| & input[ ..i] ) ) ,
428
428
OutputType :: HeaderObj => format ! ( "{}.coh.o" , input. rfind( '.' ) . map_or( input. as_str( ) , |i| & input[ ..i] ) ) ,
429
429
} ) ) ;
430
+ output = output. and_then ( |v| ( v != "-" ) . then_some ( v) ) ;
430
431
let mut flags = Flags { dbg_mangle : debug_mangle, ..Flags :: default ( ) } ;
431
432
let ink_ctx = inkwell:: context:: Context :: create ( ) ;
432
433
if let Some ( size) = ink_ctx. ptr_sized_int_type ( & target_machine. get_target_data ( ) , None ) . size_of ( ) . get_zero_extended_constant ( ) { flags. word_size = size as u16 ; }
0 commit comments