File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed
compiler/rustc_codegen_gcc/src Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -183,7 +183,7 @@ impl<'a> ArchiveBuilder<'a> for ArArchiveBuilder<'a> {
183
183
std:: process:: Command :: new ( "ranlib" ) . arg ( output) . status ( ) . expect ( "Couldn't run ranlib" ) ;
184
184
185
185
if !status. success ( ) {
186
- self . config . sess . emit_fatal ( RanlibFailure { exit_code : format ! ( "{:?}" , status. code( ) ) } ) ;
186
+ self . config . sess . emit_fatal ( RanlibFailure :: new ( status. code ( ) ) ) ;
187
187
}
188
188
189
189
any_members
Original file line number Diff line number Diff line change
1
+ use rustc_errors:: { DiagnosticArgValue , IntoDiagnosticArg } ;
1
2
use rustc_macros:: SessionDiagnostic ;
2
3
use rustc_span:: Span ;
4
+ use std:: borrow:: Cow ;
5
+
6
+ struct ExitCode {
7
+ pub exit_code : Option < i32 > ,
8
+ }
9
+
10
+ impl IntoDiagnosticArg for ExitCode {
11
+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
12
+ match self . exit_code {
13
+ Some ( t) => t. into_diagnostic_arg ( ) ,
14
+ None => DiagnosticArgValue :: Str ( Cow :: Borrowed ( "None" ) ) ,
15
+ }
16
+ }
17
+ }
3
18
4
19
#[ derive( SessionDiagnostic ) ]
5
20
#[ diag( codegen_gcc:: ranlib_failure) ]
6
21
pub ( crate ) struct RanlibFailure {
7
- pub exit_code : String ,
22
+ exit_code : ExitCode ,
23
+ }
24
+
25
+ impl RanlibFailure {
26
+ pub fn new ( exit_code : Option < i32 > ) -> Self {
27
+ let exit_code = ExitCode { exit_code } ;
28
+ RanlibFailure { exit_code }
29
+ }
8
30
}
9
31
10
32
#[ derive( SessionDiagnostic ) ]
You can’t perform that action at this time.
0 commit comments