|
1 | 1 | use rustc_errors::codes::*; |
2 | 2 | use rustc_errors::{ |
3 | | - Applicability, Diag, ElidedLifetimeInPathSubdiag, EmissionGuarantee, IntoDiagArg, MultiSpan, |
4 | | - Subdiagnostic, |
| 3 | + Applicability, Diag, DiagMessage, ElidedLifetimeInPathSubdiag, EmissionGuarantee, IntoDiagArg, |
| 4 | + LintDiagnostic, MultiSpan, Subdiagnostic, |
5 | 5 | }; |
6 | 6 | use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic}; |
7 | 7 | use rustc_span::{Ident, Span, Symbol}; |
@@ -1329,3 +1329,40 @@ pub(crate) struct UnusedMacroUse; |
1329 | 1329 | #[diag(resolve_macro_use_deprecated)] |
1330 | 1330 | #[help] |
1331 | 1331 | pub(crate) struct MacroUseDeprecated; |
| 1332 | + |
| 1333 | +#[derive(LintDiagnostic)] |
| 1334 | +#[diag(resolve_macro_is_private)] |
| 1335 | +pub(crate) struct MacroIsPrivate { |
| 1336 | + pub ident: Ident, |
| 1337 | +} |
| 1338 | + |
| 1339 | +#[derive(LintDiagnostic)] |
| 1340 | +#[diag(resolve_unused_macro_definition)] |
| 1341 | +pub(crate) struct UnusedMacroDefinition { |
| 1342 | + pub name: Symbol, |
| 1343 | +} |
| 1344 | + |
| 1345 | +#[derive(LintDiagnostic)] |
| 1346 | +#[diag(resolve_macro_rule_never_used)] |
| 1347 | +pub(crate) struct MacroRuleNeverUsed { |
| 1348 | + pub n: usize, |
| 1349 | + pub name: Symbol, |
| 1350 | +} |
| 1351 | + |
| 1352 | +pub(crate) struct UnstableFeature { |
| 1353 | + pub msg: DiagMessage, |
| 1354 | +} |
| 1355 | + |
| 1356 | +impl<'a> LintDiagnostic<'a, ()> for UnstableFeature { |
| 1357 | + fn decorate_lint<'b>(self, diag: &'b mut Diag<'a, ()>) { |
| 1358 | + diag.primary_message(self.msg); |
| 1359 | + } |
| 1360 | +} |
| 1361 | + |
| 1362 | +#[derive(LintDiagnostic)] |
| 1363 | +#[diag(resolve_extern_crate_not_idiomatic)] |
| 1364 | +pub(crate) struct ExternCrateNotIdiomatic { |
| 1365 | + #[suggestion(style = "verbose", code = "{code}", applicability = "machine-applicable")] |
| 1366 | + pub span: Span, |
| 1367 | + pub code: &'static str, |
| 1368 | +} |
0 commit comments