Move more early buffered lints to dyn lint diagnostics (1/N)
This commit is contained in:
@@ -260,6 +260,9 @@ resolve_macro_defined_later =
|
||||
resolve_macro_expanded_extern_crate_cannot_shadow_extern_arguments =
|
||||
macro-expanded `extern crate` items cannot shadow names passed with `--extern`
|
||||
|
||||
resolve_macro_expanded_macro_exports_accessed_by_absolute_paths = macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths
|
||||
.note = the macro is defined here
|
||||
|
||||
resolve_macro_expected_found =
|
||||
expected {$expected}, found {$found} `{$macro_path}`
|
||||
.label = not {$article} {$expected}
|
||||
@@ -339,6 +342,9 @@ resolve_param_in_ty_of_const_param =
|
||||
|
||||
resolve_pattern_doesnt_bind_name = pattern doesn't bind `{$name}`
|
||||
|
||||
resolve_proc_macro_derive_resolution_fallback = cannot find {$ns_descr} `{$ident}` in this scope
|
||||
.label = names from parent modules are not accessible without an explicit import
|
||||
|
||||
resolve_proc_macro_same_crate = can't use a procedural macro from the same crate that defines it
|
||||
.help = you can define integration tests in a directory named `tests`
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
|
||||
MACRO_EXPANDED_MACRO_EXPORTS_ACCESSED_BY_ABSOLUTE_PATHS,
|
||||
CRATE_NODE_ID,
|
||||
span_use,
|
||||
BuiltinLintDiag::MacroExpandedMacroExportsAccessedByAbsolutePaths(span_def),
|
||||
errors::MacroExpandedMacroExportsAccessedByAbsolutePaths { definition: span_def },
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ use rustc_errors::{
|
||||
Applicability, Diag, ElidedLifetimeInPathSubdiag, EmissionGuarantee, IntoDiagArg, MultiSpan,
|
||||
Subdiagnostic,
|
||||
};
|
||||
use rustc_macros::{Diagnostic, Subdiagnostic};
|
||||
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
|
||||
use rustc_span::{Ident, Span, Symbol};
|
||||
|
||||
use crate::late::PatternSource;
|
||||
@@ -566,6 +566,22 @@ pub(crate) struct ProcMacroSameCrate {
|
||||
pub(crate) is_test: bool,
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(resolve_proc_macro_derive_resolution_fallback)]
|
||||
pub(crate) struct ProcMacroDeriveResolutionFallback {
|
||||
#[label]
|
||||
pub span: Span,
|
||||
pub ns_descr: &'static str,
|
||||
pub ident: Ident,
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(resolve_macro_expanded_macro_exports_accessed_by_absolute_paths)]
|
||||
pub(crate) struct MacroExpandedMacroExportsAccessedByAbsolutePaths {
|
||||
#[note]
|
||||
pub definition: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_imported_crate)]
|
||||
pub(crate) struct CrateImported {
|
||||
|
||||
@@ -4,7 +4,6 @@ use rustc_ast::{self as ast, NodeId};
|
||||
use rustc_errors::ErrorGuaranteed;
|
||||
use rustc_hir::def::{DefKind, MacroKinds, Namespace, NonMacroAttrKind, PartialRes, PerNS};
|
||||
use rustc_middle::bug;
|
||||
use rustc_session::lint::BuiltinLintDiag;
|
||||
use rustc_session::lint::builtin::PROC_MACRO_DERIVE_RESOLUTION_FALLBACK;
|
||||
use rustc_session::parse::feature_err;
|
||||
use rustc_span::hygiene::{ExpnId, ExpnKind, LocalExpnId, MacroKind, SyntaxContext};
|
||||
@@ -520,7 +519,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
|
||||
PROC_MACRO_DERIVE_RESOLUTION_FALLBACK,
|
||||
lint_id,
|
||||
orig_ident.span,
|
||||
BuiltinLintDiag::ProcMacroDeriveResolutionFallback {
|
||||
errors::ProcMacroDeriveResolutionFallback {
|
||||
span: orig_ident.span,
|
||||
ns_descr: ns.descr(),
|
||||
ident,
|
||||
|
||||
Reference in New Issue
Block a user