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> {
183183 std:: process:: Command :: new ( "ranlib" ) . arg ( output) . status ( ) . expect ( "Couldn't run ranlib" ) ;
184184
185185 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 ( ) ) ) ;
187187 }
188188
189189 any_members
Original file line number Diff line number Diff line change 1+ use rustc_errors:: { DiagnosticArgValue , IntoDiagnosticArg } ;
12use rustc_macros:: SessionDiagnostic ;
23use 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+ }
318
419#[ derive( SessionDiagnostic ) ]
520#[ diag( codegen_gcc:: ranlib_failure) ]
621pub ( 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+ }
830}
931
1032#[ derive( SessionDiagnostic ) ]
You can’t perform that action at this time.
0 commit comments