@@ -142,7 +142,7 @@ pub fn compile_input(trans: Box<TransCrate>,
142
142
) ?
143
143
} ;
144
144
145
- let output_paths = generated_output_paths ( sess, & outputs, & crate_name) ;
145
+ let output_paths = generated_output_paths ( sess, & outputs, output . is_some ( ) , & crate_name) ;
146
146
147
147
// Ensure the source file isn't accidentally overwritten during compilation.
148
148
if let Some ( ref input_path) = * input_path {
@@ -1111,16 +1111,19 @@ fn escape_dep_filename(filename: &FileName) -> String {
1111
1111
// Returns all the paths that correspond to generated files.
1112
1112
fn generated_output_paths ( sess : & Session ,
1113
1113
outputs : & OutputFilenames ,
1114
+ exact_name : bool ,
1114
1115
crate_name : & str ) -> Vec < PathBuf > {
1115
1116
let mut out_filenames = Vec :: new ( ) ;
1116
1117
for output_type in sess. opts . output_types . keys ( ) {
1117
1118
let file = outputs. path ( * output_type) ;
1118
1119
match * output_type {
1119
- OutputType :: Exe => {
1120
- for output in sess. crate_types . borrow ( ) . iter ( ) {
1120
+ // If the filename has been overridden using `-o`, it will not be modified
1121
+ // by appending `.rlib`, `.exe`, etc., so we can skip this transformation.
1122
+ OutputType :: Exe if !exact_name => {
1123
+ for crate_type in sess. crate_types . borrow ( ) . iter ( ) {
1121
1124
let p = :: rustc_trans_utils:: link:: filename_for_input (
1122
1125
sess,
1123
- * output ,
1126
+ * crate_type ,
1124
1127
crate_name,
1125
1128
outputs
1126
1129
) ;
@@ -1376,10 +1379,10 @@ pub fn build_output_filenames(input: &Input,
1376
1379
Some ( out_file. clone ( ) )
1377
1380
} ;
1378
1381
if * odir != None {
1379
- sess. warn ( "ignoring --out-dir flag due to -o flag. " ) ;
1382
+ sess. warn ( "ignoring --out-dir flag due to -o flag" ) ;
1380
1383
}
1381
1384
if !sess. opts . cg . extra_filename . is_empty ( ) {
1382
- sess. warn ( "ignoring -C extra-filename flag due to -o flag. " ) ;
1385
+ sess. warn ( "ignoring -C extra-filename flag due to -o flag" ) ;
1383
1386
}
1384
1387
1385
1388
let cur_dir = Path :: new ( "" ) ;
0 commit comments