|
1 | 1 | use crate::diagnostic::DiagnosticLocation; |
2 | | -use crate::{fluent_generated as fluent, AddToDiagnostic, Diagnostic}; |
| 2 | +use crate::{fluent_generated as fluent, AddToDiagnostic}; |
3 | 3 | use crate::{DiagnosticArgValue, DiagnosticBuilder, Handler, IntoDiagnostic, IntoDiagnosticArg}; |
4 | 4 | use rustc_ast as ast; |
5 | 5 | use rustc_ast_pretty::pprust; |
6 | | -use rustc_error_messages::SubdiagnosticMessage; |
7 | 6 | use rustc_hir as hir; |
8 | | -use rustc_lint_defs::{Applicability, Level}; |
| 7 | +use rustc_lint_defs::Level; |
9 | 8 | use rustc_span::edition::Edition; |
10 | 9 | use rustc_span::symbol::{Ident, MacroRulesNormalizedIdent, Symbol}; |
11 | 10 | use rustc_span::Span; |
@@ -365,22 +364,11 @@ impl IntoDiagnosticArg for rustc_errors::Level { |
365 | 364 | } |
366 | 365 | } |
367 | 366 |
|
| 367 | +#[derive(Subdiagnostic)] |
| 368 | +#[suggestion(errors_indicate_anonymous_lifetime, code = "{suggestion}", style = "verbose")] |
368 | 369 | pub struct IndicateAnonymousLifetime { |
| 370 | + #[primary_span] |
369 | 371 | pub span: Span, |
370 | 372 | pub count: usize, |
371 | 373 | pub suggestion: String, |
372 | 374 | } |
373 | | - |
374 | | -impl AddToDiagnostic for IndicateAnonymousLifetime { |
375 | | - fn add_to_diagnostic_with<F>(self, diag: &mut Diagnostic, _: F) |
376 | | - where |
377 | | - F: Fn(&mut Diagnostic, SubdiagnosticMessage) -> SubdiagnosticMessage, |
378 | | - { |
379 | | - diag.span_suggestion_verbose( |
380 | | - self.span, |
381 | | - fluent::errors_indicate_anonymous_lifetime, |
382 | | - self.suggestion, |
383 | | - Applicability::MachineApplicable, |
384 | | - ); |
385 | | - } |
386 | | -} |
0 commit comments