|
1 | 1 | use crate::snippet::Style;
|
2 | 2 | use crate::{
|
3 |
| - CodeSuggestion, DelayedBugKind, DiagnosticBuilder, DiagnosticMessage, EmissionGuarantee, |
4 |
| - ErrCode, Level, MultiSpan, SubdiagnosticMessage, Substitution, SubstitutionPart, |
5 |
| - SuggestionStyle, |
| 3 | + CodeSuggestion, DiagnosticBuilder, DiagnosticMessage, EmissionGuarantee, ErrCode, Level, |
| 4 | + MultiSpan, SubdiagnosticMessage, Substitution, SubstitutionPart, SuggestionStyle, |
6 | 5 | };
|
7 | 6 | use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
|
8 | 7 | use rustc_error_messages::fluent_value_from_str_list_sep_by_and;
|
@@ -233,19 +232,16 @@ impl Diagnostic {
|
233 | 232 |
|
234 | 233 | pub fn is_error(&self) -> bool {
|
235 | 234 | match self.level {
|
236 |
| - Level::Bug |
237 |
| - | Level::DelayedBug(DelayedBugKind::Normal) |
238 |
| - | Level::Fatal |
239 |
| - | Level::Error |
240 |
| - | Level::FailureNote => true, |
| 235 | + Level::Bug | Level::Fatal | Level::Error | Level::DelayedBug => true, |
241 | 236 |
|
242 |
| - Level::ForceWarning(_) |
| 237 | + Level::GoodPathDelayedBug |
| 238 | + | Level::ForceWarning(_) |
243 | 239 | | Level::Warning
|
244 |
| - | Level::DelayedBug(DelayedBugKind::GoodPath) |
245 | 240 | | Level::Note
|
246 | 241 | | Level::OnceNote
|
247 | 242 | | Level::Help
|
248 | 243 | | Level::OnceHelp
|
| 244 | + | Level::FailureNote |
249 | 245 | | Level::Allow
|
250 | 246 | | Level::Expect(_) => false,
|
251 | 247 | }
|
@@ -304,11 +300,11 @@ impl Diagnostic {
|
304 | 300 | #[track_caller]
|
305 | 301 | pub fn downgrade_to_delayed_bug(&mut self) {
|
306 | 302 | assert!(
|
307 |
| - self.is_error(), |
| 303 | + matches!(self.level, Level::Error | Level::DelayedBug), |
308 | 304 | "downgrade_to_delayed_bug: cannot downgrade {:?} to DelayedBug: not an error",
|
309 | 305 | self.level
|
310 | 306 | );
|
311 |
| - self.level = Level::DelayedBug(DelayedBugKind::Normal); |
| 307 | + self.level = Level::DelayedBug; |
312 | 308 | }
|
313 | 309 |
|
314 | 310 | /// Appends a labeled span to the diagnostic.
|
|
0 commit comments