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 1
1
use std:: fs:: File ;
2
2
use std:: path:: { Path , PathBuf } ;
3
3
4
+ use crate :: errors:: RanlibFailure ;
5
+
4
6
use rustc_codegen_ssa:: back:: archive:: { ArchiveBuilder , ArchiveBuilderBuilder } ;
5
7
use rustc_session:: Session ;
6
8
@@ -181,7 +183,7 @@ impl<'a> ArchiveBuilder<'a> for ArArchiveBuilder<'a> {
181
183
std:: process:: Command :: new ( "ranlib" ) . arg ( output) . status ( ) . expect ( "Couldn't run ranlib" ) ;
182
184
183
185
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 ( ) } ) ;
185
187
}
186
188
187
189
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;
25
25
extern crate rustc_data_structures;
26
26
extern crate rustc_errors;
27
27
extern crate rustc_hir;
28
+ extern crate rustc_macros;
28
29
extern crate rustc_metadata;
29
30
extern crate rustc_middle;
30
31
extern crate rustc_session;
@@ -50,6 +51,7 @@ mod context;
50
51
mod coverageinfo;
51
52
mod debuginfo;
52
53
mod declare;
54
+ mod errors;
53
55
mod int;
54
56
mod intrinsic;
55
57
mod 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! {
41
41
borrowck => "../locales/en-US/borrowck.ftl" ,
42
42
builtin_macros => "../locales/en-US/builtin_macros.ftl" ,
43
43
const_eval => "../locales/en-US/const_eval.ftl" ,
44
+ codegen_gcc => "../locales/en-US/codegen_gcc.ftl" ,
44
45
driver => "../locales/en-US/driver.ftl" ,
45
46
expand => "../locales/en-US/expand.ftl" ,
46
47
session => "../locales/en-US/session.ftl" ,
Original file line number Diff line number Diff line change @@ -114,6 +114,15 @@ impl IntoDiagnosticArg for char {
114
114
}
115
115
}
116
116
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
+
117
126
impl IntoDiagnosticArg for Symbol {
118
127
fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
119
128
self . to_ident_string ( ) . into_diagnostic_arg ( )
You can’t perform that action at this time.
0 commit comments