@@ -3,118 +3,116 @@ use std::borrow::Cow;
3
3
use rustc_errors:: fluent;
4
4
use rustc_errors:: DiagnosticBuilder ;
5
5
use rustc_errors:: ErrorGuaranteed ;
6
- use rustc_macros:: { SessionDiagnostic , SessionSubdiagnostic } ;
7
- use rustc_session:: SessionDiagnostic ;
6
+ use rustc_errors:: Handler ;
7
+ use rustc_errors:: IntoDiagnostic ;
8
+ use rustc_macros:: { Diagnostic , Subdiagnostic } ;
8
9
use rustc_span:: Span ;
9
10
10
11
pub ( crate ) enum UnknownCTargetFeature < ' a > {
11
12
UnknownFeaturePrefix { feature : & ' a str } ,
12
13
UnknownFeature { feature : & ' a str , rust_feature : Option < & ' a str > } ,
13
14
}
14
15
15
- impl SessionDiagnostic < ' _ , ( ) > for UnknownCTargetFeature < ' _ > {
16
- fn into_diagnostic (
17
- self ,
18
- sess : & ' _ rustc_session:: parse:: ParseSess ,
19
- ) -> DiagnosticBuilder < ' _ , ( ) > {
16
+ impl IntoDiagnostic < ' _ , ( ) > for UnknownCTargetFeature < ' _ > {
17
+ fn into_diagnostic ( self , sess : & ' _ Handler ) -> DiagnosticBuilder < ' _ , ( ) > {
20
18
match self {
21
19
UnknownCTargetFeature :: UnknownFeaturePrefix { feature } => {
22
- let mut diag = sess. struct_warn ( fluent:: codegen_llvm :: unknown_ctarget_feature ) ;
20
+ let mut diag = sess. struct_warn ( fluent:: codegen_llvm_unknown_ctarget_feature ) ;
23
21
diag. set_arg ( "feature" , feature) ;
24
- diag. note ( fluent:: codegen_llvm :: unknown_feature_prefix ) ;
22
+ diag. note ( fluent:: codegen_llvm_unknown_feature_prefix ) ;
25
23
diag
26
24
}
27
25
UnknownCTargetFeature :: UnknownFeature { feature, rust_feature } => {
28
- let mut diag = sess. struct_warn ( fluent:: codegen_llvm :: unknown_ctarget_feature ) ;
26
+ let mut diag = sess. struct_warn ( fluent:: codegen_llvm_unknown_ctarget_feature ) ;
29
27
diag. set_arg ( "feature" , feature) ;
30
- diag. note ( fluent:: codegen_llvm :: unknown_feature ) ;
28
+ diag. note ( fluent:: codegen_llvm_unknown_feature ) ;
31
29
if let Some ( rust_feature) = rust_feature {
32
- diag. help ( fluent:: codegen_llvm :: rust_feature ) ;
30
+ diag. help ( fluent:: codegen_llvm_rust_feature ) ;
33
31
diag. set_arg ( "rust_feature" , rust_feature) ;
34
32
} else {
35
- diag. note ( fluent:: codegen_llvm :: unknown_feature_fill_request ) ;
33
+ diag. note ( fluent:: codegen_llvm_unknown_feature_fill_request ) ;
36
34
}
37
35
diag
38
36
}
39
37
}
40
38
}
41
39
}
42
40
43
- #[ derive( SessionDiagnostic ) ]
44
- #[ diag( codegen_llvm :: error_creating_import_library ) ]
41
+ #[ derive( Diagnostic ) ]
42
+ #[ diag( codegen_llvm_error_creating_import_library ) ]
45
43
pub ( crate ) struct ErrorCreatingImportLibrary < ' a > {
46
44
pub lib_name : & ' a str ,
47
45
pub error : String ,
48
46
}
49
47
50
- #[ derive( SessionDiagnostic ) ]
51
- #[ diag( codegen_llvm :: instrument_coverage_requires_llvm_12 ) ]
48
+ #[ derive( Diagnostic ) ]
49
+ #[ diag( codegen_llvm_instrument_coverage_requires_llvm_12 ) ]
52
50
pub ( crate ) struct InstrumentCoverageRequiresLLVM12 ;
53
51
54
- #[ derive( SessionDiagnostic ) ]
55
- #[ diag( codegen_llvm :: symbol_already_defined ) ]
52
+ #[ derive( Diagnostic ) ]
53
+ #[ diag( codegen_llvm_symbol_already_defined ) ]
56
54
pub ( crate ) struct SymbolAlreadyDefined < ' a > {
57
55
#[ primary_span]
58
56
pub span : Span ,
59
57
pub symbol_name : & ' a str ,
60
58
}
61
59
62
- #[ derive( SessionDiagnostic ) ]
63
- #[ diag( codegen_llvm :: branch_protection_requires_aarch64 ) ]
60
+ #[ derive( Diagnostic ) ]
61
+ #[ diag( codegen_llvm_branch_protection_requires_aarch64 ) ]
64
62
pub ( crate ) struct BranchProtectionRequiresAArch64 ;
65
63
66
- #[ derive( SessionDiagnostic ) ]
67
- #[ diag( codegen_llvm :: layout_size_overflow ) ]
64
+ #[ derive( Diagnostic ) ]
65
+ #[ diag( codegen_llvm_layout_size_overflow ) ]
68
66
pub ( crate ) struct LayoutSizeOverflow {
69
67
#[ primary_span]
70
68
pub span : Span ,
71
69
pub error : String ,
72
70
}
73
71
74
- #[ derive( SessionDiagnostic ) ]
75
- #[ diag( codegen_llvm :: invalid_minimum_alignment ) ]
72
+ #[ derive( Diagnostic ) ]
73
+ #[ diag( codegen_llvm_invalid_minimum_alignment ) ]
76
74
pub ( crate ) struct InvalidMinimumAlignment {
77
75
pub err : String ,
78
76
}
79
77
80
- #[ derive( SessionDiagnostic ) ]
81
- #[ diag( codegen_llvm :: linkage_const_or_mut_type ) ]
78
+ #[ derive( Diagnostic ) ]
79
+ #[ diag( codegen_llvm_linkage_const_or_mut_type ) ]
82
80
pub ( crate ) struct LinkageConstOrMutType {
83
81
#[ primary_span]
84
82
pub span : Span ,
85
83
}
86
84
87
- #[ derive( SessionDiagnostic ) ]
88
- #[ diag( codegen_llvm :: sanitizer_memtag_requires_mte ) ]
85
+ #[ derive( Diagnostic ) ]
86
+ #[ diag( codegen_llvm_sanitizer_memtag_requires_mte ) ]
89
87
pub ( crate ) struct SanitizerMemtagRequiresMte ;
90
88
91
- #[ derive( SessionDiagnostic ) ]
92
- #[ diag( codegen_llvm :: archive_build_failure ) ]
89
+ #[ derive( Diagnostic ) ]
90
+ #[ diag( codegen_llvm_archive_build_failure ) ]
93
91
pub ( crate ) struct ArchiveBuildFailure {
94
92
pub error : std:: io:: Error ,
95
93
}
96
94
97
- #[ derive( SessionDiagnostic ) ]
98
- #[ diag( codegen_llvm :: error_writing_def_file ) ]
95
+ #[ derive( Diagnostic ) ]
96
+ #[ diag( codegen_llvm_error_writing_def_file ) ]
99
97
pub ( crate ) struct ErrorWritingDEFFile {
100
98
pub error : std:: io:: Error ,
101
99
}
102
100
103
- #[ derive( SessionDiagnostic ) ]
104
- #[ diag( codegen_llvm :: error_calling_dlltool ) ]
101
+ #[ derive( Diagnostic ) ]
102
+ #[ diag( codegen_llvm_error_calling_dlltool ) ]
105
103
pub ( crate ) struct ErrorCallingDllTool {
106
104
pub error : std:: io:: Error ,
107
105
}
108
106
109
- #[ derive( SessionDiagnostic ) ]
110
- #[ diag( codegen_llvm :: dlltool_fail_import_library ) ]
107
+ #[ derive( Diagnostic ) ]
108
+ #[ diag( codegen_llvm_dlltool_fail_import_library ) ]
111
109
pub ( crate ) struct DlltoolFailImportLibrary < ' a > {
112
110
pub stdout : Cow < ' a , str > ,
113
111
pub stderr : Cow < ' a , str > ,
114
112
}
115
113
116
- #[ derive( SessionDiagnostic ) ]
117
- #[ diag( codegen_llvm :: unknown_archive_kind ) ]
114
+ #[ derive( Diagnostic ) ]
115
+ #[ diag( codegen_llvm_unknown_archive_kind ) ]
118
116
pub ( crate ) struct UnknownArchiveKind < ' a > {
119
117
pub kind : & ' a str ,
120
118
}
@@ -124,21 +122,18 @@ pub(crate) struct TargetFeatureDisableOrEnable<'a> {
124
122
pub span : Option < Span > ,
125
123
}
126
124
127
- #[ derive( SessionSubdiagnostic ) ]
128
- #[ help( codegen_llvm :: missing_features ) ]
125
+ #[ derive( Subdiagnostic ) ]
126
+ #[ help( codegen_llvm_missing_features ) ]
129
127
pub ( crate ) struct MissingFeatures ;
130
128
131
- impl SessionDiagnostic < ' _ , ErrorGuaranteed > for TargetFeatureDisableOrEnable < ' _ > {
132
- fn into_diagnostic (
133
- self ,
134
- sess : & ' _ rustc_session:: parse:: ParseSess ,
135
- ) -> DiagnosticBuilder < ' _ , ErrorGuaranteed > {
129
+ impl IntoDiagnostic < ' _ , ErrorGuaranteed > for TargetFeatureDisableOrEnable < ' _ > {
130
+ fn into_diagnostic ( self , sess : & ' _ Handler ) -> DiagnosticBuilder < ' _ , ErrorGuaranteed > {
136
131
let mut diag = if let Some ( span) = self . span {
137
- let mut diag = sess. struct_err ( fluent:: codegen_llvm :: target_feature_disable_or_enable ) ;
132
+ let mut diag = sess. struct_err ( fluent:: codegen_llvm_target_feature_disable_or_enable ) ;
138
133
diag. set_span ( span) ;
139
134
diag
140
135
} else {
141
- sess. struct_err ( fluent:: codegen_llvm :: target_feature_disable_or_enable )
136
+ sess. struct_err ( fluent:: codegen_llvm_target_feature_disable_or_enable )
142
137
} ;
143
138
diag. set_arg ( "features" , self . features . join ( ", " ) ) ;
144
139
diag
0 commit comments