File tree Expand file tree Collapse file tree 4 files changed +24
-8
lines changed
rustc_error_messages/locales/en-US Expand file tree Collapse file tree 4 files changed +24
-8
lines changed Original file line number Diff line number Diff line change 11use crate :: back:: write:: { self , save_temp_bitcode, DiagnosticHandlers } ;
2+ use crate :: errors:: DynamicLinkingWithLTO ;
23use crate :: llvm:: { self , build_string} ;
34use crate :: { LlvmCodegenBackend , ModuleLlvm } ;
45use object:: read:: archive:: ArchiveFile ;
@@ -90,13 +91,7 @@ fn prepare_lto(
9091 }
9192
9293 if cgcx. opts . cg . prefer_dynamic && !cgcx. opts . unstable_opts . dylib_lto {
93- diag_handler
94- . struct_err ( "cannot prefer dynamic linking when performing LTO" )
95- . note (
96- "only 'staticlib', 'bin', and 'cdylib' outputs are \
97- supported with LTO",
98- )
99- . emit ( ) ;
94+ diag_handler. emit_err ( DynamicLinkingWithLTO ) ;
10095 return Err ( FatalError ) ;
10196 }
10297
Original file line number Diff line number Diff line change @@ -117,6 +117,17 @@ pub(crate) struct UnknownArchiveKind<'a> {
117117 pub kind : & ' a str ,
118118}
119119
120+ #[ derive( Diagnostic ) ]
121+ #[ diag( codegen_llvm_dynamic_linking_with_lto) ]
122+ #[ note]
123+ pub ( crate ) struct DynamicLinkingWithLTO ;
124+
125+ #[ derive( Diagnostic ) ]
126+ #[ diag( codegen_llvm_fail_parsing_target_machine_config_to_target_machine) ]
127+ pub ( crate ) struct FailParsingTargetMachineConfigToTargetMachine {
128+ pub error : String ,
129+ }
130+
120131pub ( crate ) struct TargetFeatureDisableOrEnable < ' a > {
121132 pub features : & ' a [ & ' a str ] ,
122133 pub span : Option < Span > ,
Original file line number Diff line number Diff line change 1212#![ feature( iter_intersperse) ]
1313#![ recursion_limit = "256" ]
1414#![ allow( rustc:: potential_query_instability) ]
15+ #![ deny( rustc:: untranslatable_diagnostic) ]
16+ #![ deny( rustc:: diagnostic_outside_of_impl) ]
1517
1618#[ macro_use]
1719extern crate rustc_macros;
@@ -20,6 +22,7 @@ extern crate tracing;
2022
2123use back:: write:: { create_informational_target_machine, create_target_machine} ;
2224
25+ use errors:: FailParsingTargetMachineConfigToTargetMachine ;
2326pub use llvm_util:: target_features;
2427use rustc_ast:: expand:: allocator:: AllocatorKind ;
2528use rustc_codegen_ssa:: back:: lto:: { LtoModuleCodegen , SerializedModule , ThinModule } ;
@@ -413,7 +416,7 @@ impl ModuleLlvm {
413416 let tm = match ( cgcx. tm_factory ) ( tm_factory_config) {
414417 Ok ( m) => m,
415418 Err ( e) => {
416- handler. struct_err ( & e ) . emit ( ) ;
419+ handler. emit_err ( FailParsingTargetMachineConfigToTargetMachine { error : e } ) ;
417420 return Err ( FatalError ) ;
418421 }
419422 } ;
Original file line number Diff line number Diff line change @@ -57,3 +57,10 @@ codegen_llvm_target_feature_disable_or_enable =
5757
5858codegen_llvm_missing_features =
5959 add the missing features in a `target_feature` attribute
60+
61+ codegen_llvm_dynamic_linking_with_lto =
62+ cannot prefer dynamic linking when performing LTO
63+ .note = only 'staticlib', 'bin', and 'cdylib' outputs are supported with LTO
64+
65+ codegen_llvm_fail_parsing_target_machine_config_to_target_machine =
66+ failed to parse target machine config to target machine: { $error }
You can’t perform that action at this time.
0 commit comments