@@ -115,36 +115,22 @@ pub trait EmissionGuarantee: Sized {
115
115
) -> DiagnosticBuilder < ' _ , Self > ;
116
116
}
117
117
118
- /// Private module for sealing the `IsError` helper trait.
119
- mod sealed_level_is_error {
120
- use crate :: Level ;
121
-
122
- /// Sealed helper trait for statically checking that a `Level` is an error.
123
- pub ( crate ) trait IsError < const L : Level > { }
124
-
125
- impl IsError < { Level :: Bug } > for ( ) { }
126
- impl IsError < { Level :: DelayedBug } > for ( ) { }
127
- impl IsError < { Level :: Fatal } > for ( ) { }
128
- // NOTE(eddyb) `Level::Error { lint: true }` is also an error, but lints
129
- // don't need error guarantees, as their levels are always dynamic.
130
- impl IsError < { Level :: Error { lint : false } } > for ( ) { }
131
- }
132
-
133
118
impl < ' a > DiagnosticBuilder < ' a , ErrorGuaranteed > {
134
119
/// Convenience function for internal use, clients should use one of the
135
120
/// `struct_*` methods on [`Handler`].
136
121
#[ track_caller]
137
- pub ( crate ) fn new_guaranteeing_error < M : Into < DiagnosticMessage > , const L : Level > (
122
+ pub ( crate ) fn new_guaranteeing_error < M : Into < DiagnosticMessage > > (
138
123
handler : & ' a Handler ,
139
124
message : M ,
140
- ) -> Self
141
- where
142
- ( ) : sealed_level_is_error:: IsError < L > ,
143
- {
125
+ ) -> Self {
144
126
Self {
145
127
inner : DiagnosticBuilderInner {
146
128
state : DiagnosticBuilderState :: Emittable ( handler) ,
147
- diagnostic : Box :: new ( Diagnostic :: new_with_code ( L , None , message) ) ,
129
+ diagnostic : Box :: new ( Diagnostic :: new_with_code (
130
+ Level :: Error { lint : false } ,
131
+ None ,
132
+ message,
133
+ ) ) ,
148
134
} ,
149
135
_marker : PhantomData ,
150
136
}
@@ -203,9 +189,7 @@ impl EmissionGuarantee for ErrorGuaranteed {
203
189
handler : & Handler ,
204
190
msg : impl Into < DiagnosticMessage > ,
205
191
) -> DiagnosticBuilder < ' _ , Self > {
206
- DiagnosticBuilder :: new_guaranteeing_error :: < _ , { Level :: Error { lint : false } } > (
207
- handler, msg,
208
- )
192
+ DiagnosticBuilder :: new_guaranteeing_error ( handler, msg)
209
193
}
210
194
}
211
195
0 commit comments