File tree Expand file tree Collapse file tree 6 files changed +24
-1
lines changed
Expand file tree Collapse file tree 6 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 11use std:: fs:: File ;
22use std:: path:: { Path , PathBuf } ;
33
4+ use crate :: errors:: RanlibFailure ;
5+
46use rustc_codegen_ssa:: back:: archive:: { ArchiveBuilder , ArchiveBuilderBuilder } ;
57use rustc_session:: Session ;
68
@@ -181,7 +183,7 @@ impl<'a> ArchiveBuilder<'a> for ArArchiveBuilder<'a> {
181183 std:: process:: Command :: new ( "ranlib" ) . arg ( output) . status ( ) . expect ( "Couldn't run ranlib" ) ;
182184
183185 if !status. success ( ) {
184- self . config . sess . fatal ( & format ! ( "Ranlib exited with code {:?}" , status. code( ) ) ) ;
186+ self . config . sess . emit_fatal ( RanlibFailure { exit_code : status. code ( ) } ) ;
185187 }
186188
187189 any_members
Original file line number Diff line number Diff line change 1+ use rustc_macros:: SessionDiagnostic ;
2+
3+ #[ derive( SessionDiagnostic ) ]
4+ #[ diag( codegen_gcc:: ranlib_failure) ]
5+ pub ( crate ) struct RanlibFailure {
6+ pub exit_code : Option < i32 >
7+ }
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ extern crate rustc_codegen_ssa;
2525extern crate rustc_data_structures;
2626extern crate rustc_errors;
2727extern crate rustc_hir;
28+ extern crate rustc_macros;
2829extern crate rustc_metadata;
2930extern crate rustc_middle;
3031extern crate rustc_session;
@@ -50,6 +51,7 @@ mod context;
5051mod coverageinfo;
5152mod debuginfo;
5253mod declare;
54+ mod errors;
5355mod int;
5456mod intrinsic;
5557mod mono_item;
Original file line number Diff line number Diff line change 1+ codegen_gcc_ranlib_failure =
2+ Ranlib exited with code { $exit_code }
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ fluent_messages! {
4141 borrowck => "../locales/en-US/borrowck.ftl" ,
4242 builtin_macros => "../locales/en-US/builtin_macros.ftl" ,
4343 const_eval => "../locales/en-US/const_eval.ftl" ,
44+ codegen_gcc => "../locales/en-US/codegen_gcc.ftl" ,
4445 driver => "../locales/en-US/driver.ftl" ,
4546 expand => "../locales/en-US/expand.ftl" ,
4647 session => "../locales/en-US/session.ftl" ,
Original file line number Diff line number Diff line change @@ -114,6 +114,15 @@ impl IntoDiagnosticArg for char {
114114 }
115115}
116116
117+ impl < T : IntoDiagnosticArg > IntoDiagnosticArg for Option < T > {
118+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
119+ match self {
120+ Some ( t) => t. into_diagnostic_arg ( ) ,
121+ None => DiagnosticArgValue :: Str ( Cow :: Borrowed ( "None" ) ) ,
122+ }
123+ }
124+ }
125+
117126impl IntoDiagnosticArg for Symbol {
118127 fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
119128 self . to_ident_string ( ) . into_diagnostic_arg ( )
You can’t perform that action at this time.
0 commit comments