@@ -495,7 +495,7 @@ pub fn stop_after_phase_5(sess: &Session) -> bool {
495
495
fn write_out_deps ( sess : & Session ,
496
496
input : & Input ,
497
497
outputs : & OutputFilenames ,
498
- krate : & ast:: Crate ) -> io :: IoResult < ( ) > {
498
+ krate : & ast:: Crate ) {
499
499
let id = link:: find_crate_id ( krate. attrs . as_slice ( ) , outputs. out_filestem ) ;
500
500
501
501
let mut out_filenames = Vec :: new ( ) ;
@@ -524,28 +524,34 @@ fn write_out_deps(sess: &Session,
524
524
StrInput ( ..) => {
525
525
sess. warn ( "can not write --dep-info without a filename \
526
526
when compiling stdin.") ;
527
- return Ok ( ( ) ) ;
527
+ return
528
528
} ,
529
529
} ,
530
- _ => return Ok ( ( ) ) ,
530
+ _ => return ,
531
531
} ;
532
532
533
- // Build a list of files used to compile the output and
534
- // write Makefile-compatible dependency rules
535
- let files: Vec < ~str > = sess. codemap ( ) . files . borrow ( )
536
- . iter ( ) . filter_map ( |fmap| {
537
- if fmap. is_real_file ( ) {
538
- Some ( fmap. name . clone ( ) )
539
- } else {
540
- None
541
- }
542
- } ) . collect ( ) ;
543
- let mut file = try!( io:: File :: create ( & deps_filename) ) ;
544
- for path in out_filenames. iter ( ) {
545
- try!( write ! ( & mut file as & mut Writer ,
546
- "{}: {}\n \n " , path. display( ) , files. connect( " " ) ) ) ;
533
+ let result = ( || {
534
+ // Build a list of files used to compile the output and
535
+ // write Makefile-compatible dependency rules
536
+ let files: Vec < ~str > = sess. codemap ( ) . files . borrow ( )
537
+ . iter ( ) . filter ( |fmap| fmap. is_real_file ( ) )
538
+ . map ( |fmap| fmap. name . clone ( ) )
539
+ . collect ( ) ;
540
+ let mut file = try!( io:: File :: create ( & deps_filename) ) ;
541
+ for path in out_filenames. iter ( ) {
542
+ try!( write ! ( & mut file as & mut Writer ,
543
+ "{}: {}\n \n " , path. display( ) , files. connect( " " ) ) ) ;
544
+ }
545
+ Ok ( ( ) )
546
+ } ) ( ) ;
547
+
548
+ match result {
549
+ Ok ( ( ) ) => { }
550
+ Err ( e) => {
551
+ sess. fatal ( format ! ( "error writing dependencies to `{}`: {}" ,
552
+ deps_filename. display( ) , e) ) ;
553
+ }
547
554
}
548
- Ok ( ( ) )
549
555
}
550
556
551
557
pub fn compile_input ( sess : Session , cfg : ast:: CrateConfig , input : & Input ,
@@ -569,7 +575,7 @@ pub fn compile_input(sess: Session, cfg: ast::CrateConfig, input: &Input,
569
575
krate, & id) ;
570
576
( outputs, expanded_crate, ast_map)
571
577
} ;
572
- write_out_deps ( & sess, input, & outputs, & expanded_crate) . unwrap ( ) ;
578
+ write_out_deps ( & sess, input, & outputs, & expanded_crate) ;
573
579
574
580
if stop_after_phase_2 ( & sess) { return ; }
575
581
0 commit comments