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 1
1
use crate :: back:: write:: { self , save_temp_bitcode, DiagnosticHandlers } ;
2
+ use crate :: errors:: DynamicLinkingWithLTO ;
2
3
use crate :: llvm:: { self , build_string} ;
3
4
use crate :: { LlvmCodegenBackend , ModuleLlvm } ;
4
5
use object:: read:: archive:: ArchiveFile ;
@@ -90,13 +91,7 @@ fn prepare_lto(
90
91
}
91
92
92
93
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 ) ;
100
95
return Err ( FatalError ) ;
101
96
}
102
97
Original file line number Diff line number Diff line change @@ -117,6 +117,17 @@ pub(crate) struct UnknownArchiveKind<'a> {
117
117
pub kind : & ' a str ,
118
118
}
119
119
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
+
120
131
pub ( crate ) struct TargetFeatureDisableOrEnable < ' a > {
121
132
pub features : & ' a [ & ' a str ] ,
122
133
pub span : Option < Span > ,
Original file line number Diff line number Diff line change 12
12
#![ feature( iter_intersperse) ]
13
13
#![ recursion_limit = "256" ]
14
14
#![ allow( rustc:: potential_query_instability) ]
15
+ #![ deny( rustc:: untranslatable_diagnostic) ]
16
+ #![ deny( rustc:: diagnostic_outside_of_impl) ]
15
17
16
18
#[ macro_use]
17
19
extern crate rustc_macros;
@@ -20,6 +22,7 @@ extern crate tracing;
20
22
21
23
use back:: write:: { create_informational_target_machine, create_target_machine} ;
22
24
25
+ use errors:: FailParsingTargetMachineConfigToTargetMachine ;
23
26
pub use llvm_util:: target_features;
24
27
use rustc_ast:: expand:: allocator:: AllocatorKind ;
25
28
use rustc_codegen_ssa:: back:: lto:: { LtoModuleCodegen , SerializedModule , ThinModule } ;
@@ -413,7 +416,7 @@ impl ModuleLlvm {
413
416
let tm = match ( cgcx. tm_factory ) ( tm_factory_config) {
414
417
Ok ( m) => m,
415
418
Err ( e) => {
416
- handler. struct_err ( & e ) . emit ( ) ;
419
+ handler. emit_err ( FailParsingTargetMachineConfigToTargetMachine { error : e } ) ;
417
420
return Err ( FatalError ) ;
418
421
}
419
422
} ;
Original file line number Diff line number Diff line change @@ -57,3 +57,10 @@ codegen_llvm_target_feature_disable_or_enable =
57
57
58
58
codegen_llvm_missing_features =
59
59
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