File tree Expand file tree Collapse file tree 3 files changed +12
-3
lines changed
rustc_error_messages/locales/en-US Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 1
1
use super :: command:: Command ;
2
2
use super :: symbol_export;
3
+ use crate :: errors:: LibDefWriteFailure ;
3
4
use rustc_span:: symbol:: sym;
4
5
5
6
use std:: ffi:: { OsStr , OsString } ;
@@ -666,7 +667,7 @@ impl<'a> Linker for GccLinker<'a> {
666
667
}
667
668
} ;
668
669
if let Err ( e) = res {
669
- self . sess . fatal ( & format ! ( "failed to write lib.def file: {}" , e ) ) ;
670
+ self . sess . emit_fatal ( LibDefWriteFailure { error_description : format ! ( "{e}" ) } ) ;
670
671
}
671
672
} else if is_windows {
672
673
let res: io:: Result < ( ) > = try {
@@ -681,7 +682,7 @@ impl<'a> Linker for GccLinker<'a> {
681
682
}
682
683
} ;
683
684
if let Err ( e) = res {
684
- self . sess . fatal ( & format ! ( "failed to write list.def file: {}" , e ) ) ;
685
+ self . sess . emit_fatal ( LibDefWriteFailure { error_description : format ! ( "{e}" ) } ) ;
685
686
}
686
687
} else {
687
688
// Write an LD version script
@@ -972,7 +973,7 @@ impl<'a> Linker for MsvcLinker<'a> {
972
973
}
973
974
} ;
974
975
if let Err ( e) = res {
975
- self . sess . fatal ( & format ! ( "failed to write lib.def file: {}" , e ) ) ;
976
+ self . sess . emit_fatal ( LibDefWriteFailure { error_description : format ! ( "{e}" ) } ) ;
976
977
}
977
978
let mut arg = OsString :: from ( "/DEF:" ) ;
978
979
arg. push ( path) ;
Original file line number Diff line number Diff line change @@ -7,3 +7,9 @@ use rustc_macros::SessionDiagnostic;
7
7
pub struct MissingNativeStaticLibrary < ' a > {
8
8
pub library_name : & ' a str ,
9
9
}
10
+
11
+ #[ derive( SessionDiagnostic ) ]
12
+ #[ diag( codegen_ssa:: lib_def_write_failure) ]
13
+ pub struct LibDefWriteFailure {
14
+ pub error_description : String ,
15
+ }
Original file line number Diff line number Diff line change 1
1
codegen_ssa_missing_native_static_library = could not find native static library `{ $library_name } `, perhaps an -L flag is missing?
2
+
3
+ codegen_ssa_lib_def_write_failure = failed to write lib.def file: { $error_description }
You can’t perform that action at this time.
0 commit comments