Rename BuiltinLintDiagnostics
as BuiltinLintDiag
.
Not the dropping of the trailing `s` -- this type describes a single diagnostic and its name should be singular.
This commit is contained in:
parent
d98ad0a181
commit
7aa0eea19c
@ -18,7 +18,7 @@
|
||||
use rustc_session::lint::builtin::{
|
||||
DEPRECATED_WHERE_CLAUSE_LOCATION, MISSING_ABI, PATTERNS_IN_FNS_WITHOUT_BODY,
|
||||
};
|
||||
use rustc_session::lint::{BuiltinLintDiagnostics, LintBuffer};
|
||||
use rustc_session::lint::{BuiltinLintDiag, LintBuffer};
|
||||
use rustc_session::Session;
|
||||
use rustc_span::symbol::{kw, sym, Ident};
|
||||
use rustc_span::Span;
|
||||
@ -750,7 +750,7 @@ fn maybe_lint_missing_abi(&mut self, span: Span, id: NodeId) {
|
||||
id,
|
||||
span,
|
||||
fluent::ast_passes_extern_without_abi,
|
||||
BuiltinLintDiagnostics::MissingAbi(span, abi::Abi::FALLBACK),
|
||||
BuiltinLintDiag::MissingAbi(span, abi::Abi::FALLBACK),
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -1408,7 +1408,7 @@ fn visit_fn(&mut self, fk: FnKind<'a>, span: Span, id: NodeId) {
|
||||
FnCtxt::Foreign => fluent::ast_passes_pattern_in_foreign,
|
||||
_ => fluent::ast_passes_pattern_in_bodiless,
|
||||
};
|
||||
let diag = BuiltinLintDiagnostics::PatternsInFnsWithoutBody(span, ident);
|
||||
let diag = BuiltinLintDiag::PatternsInFnsWithoutBody(span, ident);
|
||||
self.lint_buffer.buffer_lint_with_diagnostic(
|
||||
PATTERNS_IN_FNS_WITHOUT_BODY,
|
||||
id,
|
||||
@ -1491,7 +1491,7 @@ fn visit_assoc_item(&mut self, item: &'a AssocItem, ctxt: AssocCtxt) {
|
||||
item.id,
|
||||
err.span,
|
||||
fluent::ast_passes_deprecated_where_clause_location,
|
||||
BuiltinLintDiagnostics::DeprecatedWhereclauseLocation(sugg),
|
||||
BuiltinLintDiag::DeprecatedWhereclauseLocation(sugg),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
use rustc_macros::HashStable_Generic;
|
||||
use rustc_session::config::ExpectedValues;
|
||||
use rustc_session::lint::builtin::UNEXPECTED_CFGS;
|
||||
use rustc_session::lint::BuiltinLintDiagnostics;
|
||||
use rustc_session::lint::BuiltinLintDiag;
|
||||
use rustc_session::parse::feature_err;
|
||||
use rustc_session::{RustcVersion, Session};
|
||||
use rustc_span::hygiene::Transparency;
|
||||
@ -535,7 +535,7 @@ pub fn cfg_matches(
|
||||
} else {
|
||||
format!("unexpected `cfg` condition value: (none)")
|
||||
},
|
||||
BuiltinLintDiagnostics::UnexpectedCfgValue(
|
||||
BuiltinLintDiag::UnexpectedCfgValue(
|
||||
(cfg.name, cfg.name_span),
|
||||
cfg.value.map(|v| (v, cfg.value_span.unwrap())),
|
||||
),
|
||||
@ -547,7 +547,7 @@ pub fn cfg_matches(
|
||||
cfg.span,
|
||||
lint_node_id,
|
||||
format!("unexpected `cfg` condition name: `{}`", cfg.name),
|
||||
BuiltinLintDiagnostics::UnexpectedCfgName(
|
||||
BuiltinLintDiag::UnexpectedCfgName(
|
||||
(cfg.name, cfg.name_span),
|
||||
cfg.value.map(|v| (v, cfg.value_span.unwrap())),
|
||||
),
|
||||
|
@ -1603,9 +1603,10 @@ fn create_struct_field_access_fields(
|
||||
// Once use of `icu4x-0.9.0` has dropped sufficiently, this
|
||||
// exception should be removed.
|
||||
let is_simple_path = |ty: &P<ast::Ty>, sym| {
|
||||
if let TyKind::Path(None, ast::Path { segments, .. }) = &ty.kind &&
|
||||
let [seg] = segments.as_slice() &&
|
||||
seg.ident.name == sym && seg.args.is_none()
|
||||
if let TyKind::Path(None, ast::Path { segments, .. }) = &ty.kind
|
||||
&& let [seg] = segments.as_slice()
|
||||
&& seg.ident.name == sym
|
||||
&& seg.args.is_none()
|
||||
{
|
||||
true
|
||||
} else {
|
||||
@ -1613,8 +1614,8 @@ fn create_struct_field_access_fields(
|
||||
}
|
||||
};
|
||||
|
||||
let exception = if let TyKind::Slice(ty) = &struct_field.ty.kind &&
|
||||
is_simple_path(ty, sym::u8)
|
||||
let exception = if let TyKind::Slice(ty) = &struct_field.ty.kind
|
||||
&& is_simple_path(ty, sym::u8)
|
||||
{
|
||||
Some("byte")
|
||||
} else if is_simple_path(&struct_field.ty, sym::str) {
|
||||
@ -1631,7 +1632,7 @@ fn create_struct_field_access_fields(
|
||||
format!(
|
||||
"{ty} slice in a packed struct that derives a built-in trait"
|
||||
),
|
||||
rustc_lint_defs::BuiltinLintDiagnostics::ByteSliceInPackedStructWithDerive
|
||||
rustc_lint_defs::BuiltinLintDiag::ByteSliceInPackedStructWithDerive,
|
||||
);
|
||||
} else {
|
||||
// Wrap the expression in `{...}`, causing a copy.
|
||||
|
@ -16,7 +16,7 @@
|
||||
use rustc_span::{BytePos, ErrorGuaranteed, InnerSpan, Span};
|
||||
|
||||
use rustc_lint_defs::builtin::NAMED_ARGUMENTS_USED_POSITIONALLY;
|
||||
use rustc_lint_defs::{BufferedEarlyLint, BuiltinLintDiagnostics, LintId};
|
||||
use rustc_lint_defs::{BufferedEarlyLint, BuiltinLintDiag, LintId};
|
||||
|
||||
// The format_args!() macro is expanded in three steps:
|
||||
// 1. First, `parse_args` will parse the `(literal, arg, arg, name=arg, name=arg)` syntax,
|
||||
@ -553,7 +553,7 @@ enum ArgRef<'a> {
|
||||
msg: format!("named argument `{}` is not used by name", arg_name.name).into(),
|
||||
node_id: rustc_ast::CRATE_NODE_ID,
|
||||
lint_id: LintId::of(NAMED_ARGUMENTS_USED_POSITIONALLY),
|
||||
diagnostic: BuiltinLintDiagnostics::NamedArgumentUsedPositionally {
|
||||
diagnostic: BuiltinLintDiag::NamedArgumentUsedPositionally {
|
||||
position_sp_to_replace,
|
||||
position_sp_for_msg,
|
||||
named_arg_sp: arg_name.span,
|
||||
|
@ -16,7 +16,7 @@
|
||||
use rustc_errors::{Applicability, Diag, DiagCtxt, ErrorGuaranteed, PResult};
|
||||
use rustc_feature::Features;
|
||||
use rustc_lint_defs::builtin::PROC_MACRO_BACK_COMPAT;
|
||||
use rustc_lint_defs::{BufferedEarlyLint, BuiltinLintDiagnostics, RegisteredTools};
|
||||
use rustc_lint_defs::{BufferedEarlyLint, BuiltinLintDiag, RegisteredTools};
|
||||
use rustc_parse::{parser, MACRO_ARGUMENTS};
|
||||
use rustc_session::config::CollapseMacroDebuginfo;
|
||||
use rustc_session::errors::report_lit_error;
|
||||
@ -1488,7 +1488,7 @@ fn pretty_printing_compatibility_hack(item: &Item, sess: &Session) -> bool {
|
||||
item.ident.span,
|
||||
ast::CRATE_NODE_ID,
|
||||
"using an old version of `rental`",
|
||||
BuiltinLintDiagnostics::ProcMacroBackCompat(
|
||||
BuiltinLintDiag::ProcMacroBackCompat(
|
||||
"older versions of the `rental` crate will stop compiling in future versions of Rust; \
|
||||
please update to `rental` v0.5.6, or switch to one of the `rental` alternatives".to_string()
|
||||
)
|
||||
|
@ -30,7 +30,7 @@
|
||||
};
|
||||
use rustc_parse::validate_attr;
|
||||
use rustc_session::lint::builtin::{UNUSED_ATTRIBUTES, UNUSED_DOC_COMMENTS};
|
||||
use rustc_session::lint::BuiltinLintDiagnostics;
|
||||
use rustc_session::lint::BuiltinLintDiag;
|
||||
use rustc_session::parse::feature_err;
|
||||
use rustc_session::{Limit, Session};
|
||||
use rustc_span::symbol::{sym, Ident};
|
||||
@ -1711,7 +1711,7 @@ fn check_attributes(&self, attrs: &[ast::Attribute], call: &ast::MacCall) {
|
||||
current_span,
|
||||
self.cx.current_expansion.lint_node_id,
|
||||
"unused doc comment",
|
||||
BuiltinLintDiagnostics::UnusedDocComment(attr.span),
|
||||
BuiltinLintDiag::UnusedDocComment(attr.span),
|
||||
);
|
||||
} else if rustc_attr::is_builtin_attr(attr) {
|
||||
let attr_name = attr.ident().unwrap().name;
|
||||
@ -1723,7 +1723,7 @@ fn check_attributes(&self, attrs: &[ast::Attribute], call: &ast::MacCall) {
|
||||
attr.span,
|
||||
self.cx.current_expansion.lint_node_id,
|
||||
format!("unused attribute `{attr_name}`"),
|
||||
BuiltinLintDiagnostics::UnusedBuiltinAttribute {
|
||||
BuiltinLintDiag::UnusedBuiltinAttribute {
|
||||
attr_name,
|
||||
macro_name: pprust::path_to_string(&call.path),
|
||||
invoc_span: call.path.span,
|
||||
|
@ -21,7 +21,7 @@
|
||||
use rustc_lint_defs::builtin::{
|
||||
RUST_2021_INCOMPATIBLE_OR_PATTERNS, SEMICOLON_IN_EXPRESSIONS_FROM_MACROS,
|
||||
};
|
||||
use rustc_lint_defs::BuiltinLintDiagnostics;
|
||||
use rustc_lint_defs::BuiltinLintDiag;
|
||||
use rustc_parse::parser::{Parser, Recovery};
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_session::Session;
|
||||
@ -83,7 +83,7 @@ pub(crate) fn make(mut self: Box<ParserAnyMacro<'a>>, kind: AstFragmentKind) ->
|
||||
parser.token.span,
|
||||
lint_node_id,
|
||||
"trailing semicolon in macro used in expression position",
|
||||
BuiltinLintDiagnostics::TrailingMacro(is_trailing_mac, macro_ident),
|
||||
BuiltinLintDiag::TrailingMacro(is_trailing_mac, macro_ident),
|
||||
);
|
||||
}
|
||||
parser.bump();
|
||||
@ -1154,7 +1154,7 @@ fn check_matcher_core<'tt>(
|
||||
span,
|
||||
ast::CRATE_NODE_ID,
|
||||
"the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro",
|
||||
BuiltinLintDiagnostics::OrPatternsBackCompat(span, suggestion),
|
||||
BuiltinLintDiag::OrPatternsBackCompat(span, suggestion),
|
||||
);
|
||||
}
|
||||
match is_in_follow(next_token, kind) {
|
||||
|
@ -9,7 +9,7 @@
|
||||
use rustc_session as session;
|
||||
use rustc_session::config::{self, Cfg, CrateType, OutFileName, OutputFilenames, OutputTypes};
|
||||
use rustc_session::filesearch::sysroot_candidates;
|
||||
use rustc_session::lint::{self, BuiltinLintDiagnostics, LintBuffer};
|
||||
use rustc_session::lint::{self, BuiltinLintDiag, LintBuffer};
|
||||
use rustc_session::{filesearch, output, Session};
|
||||
use rustc_span::edit_distance::find_best_match_for_name;
|
||||
use rustc_span::edition::Edition;
|
||||
@ -345,7 +345,7 @@ pub(crate) fn check_attr_crate_type(
|
||||
ast::CRATE_NODE_ID,
|
||||
span,
|
||||
"invalid `crate_type` value",
|
||||
BuiltinLintDiagnostics::UnknownCrateTypes(
|
||||
BuiltinLintDiag::UnknownCrateTypes(
|
||||
span,
|
||||
"did you mean".to_string(),
|
||||
format!("\"{candidate}\""),
|
||||
|
@ -58,7 +58,7 @@
|
||||
use rustc_middle::ty::ToPredicate;
|
||||
use rustc_middle::ty::TypeVisitableExt;
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt, VariantDef};
|
||||
use rustc_session::lint::{BuiltinLintDiagnostics, FutureIncompatibilityReason};
|
||||
use rustc_session::lint::{BuiltinLintDiag, FutureIncompatibilityReason};
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
||||
@ -2831,7 +2831,7 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'tcx>) {
|
||||
Some(target_spans),
|
||||
fluent::lint_builtin_asm_labels,
|
||||
|_| {},
|
||||
BuiltinLintDiagnostics::NamedAsmLabel(
|
||||
BuiltinLintDiag::NamedAsmLabel(
|
||||
"only local labels of the form `<number>:` should be used in inline asm"
|
||||
.to_string(),
|
||||
),
|
||||
|
@ -31,7 +31,7 @@
|
||||
use rustc_middle::ty::layout::{LayoutError, LayoutOfHelpers, TyAndLayout};
|
||||
use rustc_middle::ty::print::{with_no_trimmed_paths, PrintError};
|
||||
use rustc_middle::ty::{self, print::Printer, GenericArg, RegisteredTools, Ty, TyCtxt};
|
||||
use rustc_session::lint::{BuiltinLintDiagnostics, LintExpectationId};
|
||||
use rustc_session::lint::{BuiltinLintDiag, LintExpectationId};
|
||||
use rustc_session::lint::{FutureIncompatibleInfo, Level, Lint, LintBuffer, LintId};
|
||||
use rustc_session::{LintStoreMarker, Session};
|
||||
use rustc_span::edit_distance::find_best_match_for_names;
|
||||
@ -538,7 +538,7 @@ fn span_lint_with_diagnostics(
|
||||
span: Option<impl Into<MultiSpan>>,
|
||||
msg: impl Into<DiagMessage>,
|
||||
decorate: impl for<'a, 'b> FnOnce(&'b mut Diag<'a, ()>),
|
||||
diagnostic: BuiltinLintDiagnostics,
|
||||
diagnostic: BuiltinLintDiag,
|
||||
) {
|
||||
// We first generate a blank diagnostic.
|
||||
self.opt_span_lint(lint, span, msg, |db| {
|
||||
|
@ -6,15 +6,15 @@
|
||||
use rustc_errors::{Applicability, SuggestionStyle};
|
||||
use rustc_middle::middle::stability;
|
||||
use rustc_session::config::ExpectedValues;
|
||||
use rustc_session::lint::BuiltinLintDiagnostics;
|
||||
use rustc_session::lint::BuiltinLintDiag;
|
||||
use rustc_session::Session;
|
||||
use rustc_span::edit_distance::find_best_match_for_name;
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::BytePos;
|
||||
|
||||
pub(super) fn builtin(sess: &Session, diagnostic: BuiltinLintDiagnostics, diag: &mut Diag<'_, ()>) {
|
||||
pub(super) fn builtin(sess: &Session, diagnostic: BuiltinLintDiag, diag: &mut Diag<'_, ()>) {
|
||||
match diagnostic {
|
||||
BuiltinLintDiagnostics::UnicodeTextFlow(span, content) => {
|
||||
BuiltinLintDiag::UnicodeTextFlow(span, content) => {
|
||||
let spans: Vec<_> = content
|
||||
.char_indices()
|
||||
.filter_map(|(i, c)| {
|
||||
@ -51,8 +51,8 @@ pub(super) fn builtin(sess: &Session, diagnostic: BuiltinLintDiagnostics, diag:
|
||||
);
|
||||
}
|
||||
}
|
||||
BuiltinLintDiagnostics::Normal => (),
|
||||
BuiltinLintDiagnostics::AbsPathWithModule(span) => {
|
||||
BuiltinLintDiag::Normal => (),
|
||||
BuiltinLintDiag::AbsPathWithModule(span) => {
|
||||
let (sugg, app) = match sess.source_map().span_to_snippet(span) {
|
||||
Ok(ref s) => {
|
||||
// FIXME(Manishearth) ideally the emitting code
|
||||
@ -65,21 +65,16 @@ pub(super) fn builtin(sess: &Session, diagnostic: BuiltinLintDiagnostics, diag:
|
||||
};
|
||||
diag.span_suggestion(span, "use `crate`", sugg, app);
|
||||
}
|
||||
BuiltinLintDiagnostics::ProcMacroDeriveResolutionFallback(span) => {
|
||||
BuiltinLintDiag::ProcMacroDeriveResolutionFallback(span) => {
|
||||
diag.span_label(
|
||||
span,
|
||||
"names from parent modules are not accessible without an explicit import",
|
||||
);
|
||||
}
|
||||
BuiltinLintDiagnostics::MacroExpandedMacroExportsAccessedByAbsolutePaths(span_def) => {
|
||||
BuiltinLintDiag::MacroExpandedMacroExportsAccessedByAbsolutePaths(span_def) => {
|
||||
diag.span_note(span_def, "the macro is defined here");
|
||||
}
|
||||
BuiltinLintDiagnostics::ElidedLifetimesInPaths(
|
||||
n,
|
||||
path_span,
|
||||
incl_angl_brckt,
|
||||
insertion_span,
|
||||
) => {
|
||||
BuiltinLintDiag::ElidedLifetimesInPaths(n, path_span, incl_angl_brckt, insertion_span) => {
|
||||
add_elided_lifetime_in_path_suggestion(
|
||||
sess.source_map(),
|
||||
diag,
|
||||
@ -89,10 +84,10 @@ pub(super) fn builtin(sess: &Session, diagnostic: BuiltinLintDiagnostics, diag:
|
||||
insertion_span,
|
||||
);
|
||||
}
|
||||
BuiltinLintDiagnostics::UnknownCrateTypes(span, note, sugg) => {
|
||||
BuiltinLintDiag::UnknownCrateTypes(span, note, sugg) => {
|
||||
diag.span_suggestion(span, note, sugg, Applicability::MaybeIncorrect);
|
||||
}
|
||||
BuiltinLintDiagnostics::UnusedImports(message, replaces, in_test_module) => {
|
||||
BuiltinLintDiag::UnusedImports(message, replaces, in_test_module) => {
|
||||
if !replaces.is_empty() {
|
||||
diag.tool_only_multipart_suggestion(
|
||||
message,
|
||||
@ -108,21 +103,21 @@ pub(super) fn builtin(sess: &Session, diagnostic: BuiltinLintDiagnostics, diag:
|
||||
);
|
||||
}
|
||||
}
|
||||
BuiltinLintDiagnostics::RedundantImport(spans, ident) => {
|
||||
BuiltinLintDiag::RedundantImport(spans, ident) => {
|
||||
for (span, is_imported) in spans {
|
||||
let introduced = if is_imported { "imported" } else { "defined" };
|
||||
diag.span_label(span, format!("the item `{ident}` is already {introduced} here"));
|
||||
}
|
||||
}
|
||||
BuiltinLintDiagnostics::DeprecatedMacro(suggestion, span) => {
|
||||
BuiltinLintDiag::DeprecatedMacro(suggestion, span) => {
|
||||
stability::deprecation_suggestion(diag, "macro", suggestion, span)
|
||||
}
|
||||
BuiltinLintDiagnostics::UnusedDocComment(span) => {
|
||||
BuiltinLintDiag::UnusedDocComment(span) => {
|
||||
diag.span_label(span, "rustdoc does not generate documentation for macro invocations");
|
||||
diag.help("to document an item produced by a macro, \
|
||||
the macro must produce the documentation as part of its expansion");
|
||||
}
|
||||
BuiltinLintDiagnostics::PatternsInFnsWithoutBody(span, ident) => {
|
||||
BuiltinLintDiag::PatternsInFnsWithoutBody(span, ident) => {
|
||||
diag.span_suggestion(
|
||||
span,
|
||||
"remove `mut` from the parameter",
|
||||
@ -130,17 +125,17 @@ pub(super) fn builtin(sess: &Session, diagnostic: BuiltinLintDiagnostics, diag:
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
}
|
||||
BuiltinLintDiagnostics::MissingAbi(span, default_abi) => {
|
||||
BuiltinLintDiag::MissingAbi(span, default_abi) => {
|
||||
diag.span_label(span, "ABI should be specified here");
|
||||
diag.help(format!("the default ABI is {}", default_abi.name()));
|
||||
}
|
||||
BuiltinLintDiagnostics::LegacyDeriveHelpers(span) => {
|
||||
BuiltinLintDiag::LegacyDeriveHelpers(span) => {
|
||||
diag.span_label(span, "the attribute is introduced here");
|
||||
}
|
||||
BuiltinLintDiagnostics::ProcMacroBackCompat(note) => {
|
||||
BuiltinLintDiag::ProcMacroBackCompat(note) => {
|
||||
diag.note(note);
|
||||
}
|
||||
BuiltinLintDiagnostics::OrPatternsBackCompat(span, suggestion) => {
|
||||
BuiltinLintDiag::OrPatternsBackCompat(span, suggestion) => {
|
||||
diag.span_suggestion(
|
||||
span,
|
||||
"use pat_param to preserve semantics",
|
||||
@ -148,7 +143,7 @@ pub(super) fn builtin(sess: &Session, diagnostic: BuiltinLintDiagnostics, diag:
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
}
|
||||
BuiltinLintDiagnostics::ReservedPrefix(span) => {
|
||||
BuiltinLintDiag::ReservedPrefix(span) => {
|
||||
diag.span_label(span, "unknown prefix");
|
||||
diag.span_suggestion_verbose(
|
||||
span.shrink_to_hi(),
|
||||
@ -157,19 +152,19 @@ pub(super) fn builtin(sess: &Session, diagnostic: BuiltinLintDiagnostics, diag:
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
}
|
||||
BuiltinLintDiagnostics::UnusedBuiltinAttribute { attr_name, macro_name, invoc_span } => {
|
||||
BuiltinLintDiag::UnusedBuiltinAttribute { attr_name, macro_name, invoc_span } => {
|
||||
diag.span_note(
|
||||
invoc_span,
|
||||
format!("the built-in attribute `{attr_name}` will be ignored, since it's applied to the macro invocation `{macro_name}`")
|
||||
);
|
||||
}
|
||||
BuiltinLintDiagnostics::TrailingMacro(is_trailing, name) => {
|
||||
BuiltinLintDiag::TrailingMacro(is_trailing, name) => {
|
||||
if is_trailing {
|
||||
diag.note("macro invocations at the end of a block are treated as expressions");
|
||||
diag.note(format!("to ignore the value produced by the macro, add a semicolon after the invocation of `{name}`"));
|
||||
}
|
||||
}
|
||||
BuiltinLintDiagnostics::BreakWithLabelAndLoop(span) => {
|
||||
BuiltinLintDiag::BreakWithLabelAndLoop(span) => {
|
||||
diag.multipart_suggestion(
|
||||
"wrap this expression in parentheses",
|
||||
vec![
|
||||
@ -179,11 +174,11 @@ pub(super) fn builtin(sess: &Session, diagnostic: BuiltinLintDiagnostics, diag:
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
}
|
||||
BuiltinLintDiagnostics::NamedAsmLabel(help) => {
|
||||
BuiltinLintDiag::NamedAsmLabel(help) => {
|
||||
diag.help(help);
|
||||
diag.note("see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information");
|
||||
}
|
||||
BuiltinLintDiagnostics::UnexpectedCfgName((name, name_span), value) => {
|
||||
BuiltinLintDiag::UnexpectedCfgName((name, name_span), value) => {
|
||||
#[allow(rustc::potential_query_instability)]
|
||||
let possibilities: Vec<Symbol> =
|
||||
sess.psess.check_config.expecteds.keys().copied().collect();
|
||||
@ -321,7 +316,7 @@ pub(super) fn builtin(sess: &Session, diagnostic: BuiltinLintDiagnostics, diag:
|
||||
diag.note("see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration");
|
||||
}
|
||||
}
|
||||
BuiltinLintDiagnostics::UnexpectedCfgValue((name, name_span), value) => {
|
||||
BuiltinLintDiag::UnexpectedCfgValue((name, name_span), value) => {
|
||||
let Some(ExpectedValues::Some(values)) = &sess.psess.check_config.expecteds.get(&name)
|
||||
else {
|
||||
bug!(
|
||||
@ -426,7 +421,7 @@ pub(super) fn builtin(sess: &Session, diagnostic: BuiltinLintDiagnostics, diag:
|
||||
diag.note("see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration");
|
||||
}
|
||||
}
|
||||
BuiltinLintDiagnostics::DeprecatedWhereclauseLocation(sugg) => {
|
||||
BuiltinLintDiag::DeprecatedWhereclauseLocation(sugg) => {
|
||||
let left_sp = diag.span.primary_span().unwrap();
|
||||
match sugg {
|
||||
Some((right_sp, sugg)) => diag.multipart_suggestion(
|
||||
@ -443,7 +438,7 @@ pub(super) fn builtin(sess: &Session, diagnostic: BuiltinLintDiagnostics, diag:
|
||||
};
|
||||
diag.note("see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information");
|
||||
}
|
||||
BuiltinLintDiagnostics::SingleUseLifetime {
|
||||
BuiltinLintDiag::SingleUseLifetime {
|
||||
param_span,
|
||||
use_span: Some((use_span, elide)),
|
||||
deletion_span,
|
||||
@ -474,11 +469,7 @@ pub(super) fn builtin(sess: &Session, diagnostic: BuiltinLintDiagnostics, diag:
|
||||
diag.multipart_suggestion(msg, suggestions, Applicability::MachineApplicable);
|
||||
}
|
||||
}
|
||||
BuiltinLintDiagnostics::SingleUseLifetime {
|
||||
param_span: _,
|
||||
use_span: None,
|
||||
deletion_span,
|
||||
} => {
|
||||
BuiltinLintDiag::SingleUseLifetime { param_span: _, use_span: None, deletion_span } => {
|
||||
debug!(?deletion_span);
|
||||
if let Some(deletion_span) = deletion_span {
|
||||
diag.span_suggestion(
|
||||
@ -489,7 +480,7 @@ pub(super) fn builtin(sess: &Session, diagnostic: BuiltinLintDiagnostics, diag:
|
||||
);
|
||||
}
|
||||
}
|
||||
BuiltinLintDiagnostics::NamedArgumentUsedPositionally {
|
||||
BuiltinLintDiag::NamedArgumentUsedPositionally {
|
||||
position_sp_to_replace,
|
||||
position_sp_for_msg,
|
||||
named_arg_sp,
|
||||
@ -525,13 +516,13 @@ pub(super) fn builtin(sess: &Session, diagnostic: BuiltinLintDiagnostics, diag:
|
||||
);
|
||||
}
|
||||
}
|
||||
BuiltinLintDiagnostics::ByteSliceInPackedStructWithDerive => {
|
||||
BuiltinLintDiag::ByteSliceInPackedStructWithDerive => {
|
||||
diag.help("consider implementing the trait by hand, or remove the `packed` attribute");
|
||||
}
|
||||
BuiltinLintDiagnostics::UnusedExternCrate { removal_span } => {
|
||||
BuiltinLintDiag::UnusedExternCrate { removal_span } => {
|
||||
diag.span_suggestion(removal_span, "remove it", "", Applicability::MachineApplicable);
|
||||
}
|
||||
BuiltinLintDiagnostics::ExternCrateNotIdiomatic { vis_span, ident_span } => {
|
||||
BuiltinLintDiag::ExternCrateNotIdiomatic { vis_span, ident_span } => {
|
||||
let suggestion_span = vis_span.between(ident_span);
|
||||
diag.span_suggestion_verbose(
|
||||
suggestion_span,
|
||||
@ -540,10 +531,10 @@ pub(super) fn builtin(sess: &Session, diagnostic: BuiltinLintDiagnostics, diag:
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
}
|
||||
BuiltinLintDiagnostics::AmbiguousGlobImports { diag: ambiguity } => {
|
||||
BuiltinLintDiag::AmbiguousGlobImports { diag: ambiguity } => {
|
||||
rustc_errors::report_ambiguity_error(diag, ambiguity);
|
||||
}
|
||||
BuiltinLintDiagnostics::AmbiguousGlobReexports {
|
||||
BuiltinLintDiag::AmbiguousGlobReexports {
|
||||
name,
|
||||
namespace,
|
||||
first_reexport_span,
|
||||
@ -560,7 +551,7 @@ pub(super) fn builtin(sess: &Session, diagnostic: BuiltinLintDiagnostics, diag:
|
||||
),
|
||||
);
|
||||
}
|
||||
BuiltinLintDiagnostics::HiddenGlobReexports {
|
||||
BuiltinLintDiag::HiddenGlobReexports {
|
||||
name,
|
||||
namespace,
|
||||
glob_reexport_span,
|
||||
@ -569,7 +560,7 @@ pub(super) fn builtin(sess: &Session, diagnostic: BuiltinLintDiagnostics, diag:
|
||||
diag.span_note(glob_reexport_span, format!("the name `{name}` in the {namespace} namespace is supposed to be publicly re-exported here"));
|
||||
diag.span_note(private_item_span, "but the private item here shadows it".to_owned());
|
||||
}
|
||||
BuiltinLintDiagnostics::UnusedQualifications { removal_span } => {
|
||||
BuiltinLintDiag::UnusedQualifications { removal_span } => {
|
||||
diag.span_suggestion_verbose(
|
||||
removal_span,
|
||||
"remove the unnecessary path segments",
|
||||
@ -577,7 +568,7 @@ pub(super) fn builtin(sess: &Session, diagnostic: BuiltinLintDiagnostics, diag:
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
}
|
||||
BuiltinLintDiagnostics::AssociatedConstElidedLifetime { elided, span } => {
|
||||
BuiltinLintDiag::AssociatedConstElidedLifetime { elided, span } => {
|
||||
diag.span_suggestion_verbose(
|
||||
if elided { span.shrink_to_hi() } else { span },
|
||||
"use the `'static` lifetime",
|
||||
@ -585,7 +576,7 @@ pub(super) fn builtin(sess: &Session, diagnostic: BuiltinLintDiagnostics, diag:
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
}
|
||||
BuiltinLintDiagnostics::RedundantImportVisibility { max_vis, span } => {
|
||||
BuiltinLintDiag::RedundantImportVisibility { max_vis, span } => {
|
||||
diag.span_note(span, format!("the most public imported item is `{max_vis}`"));
|
||||
diag.help(
|
||||
"reduce the glob import's visibility or increase visibility of imported items",
|
||||
|
@ -569,7 +569,7 @@ pub struct AmbiguityErrorDiag {
|
||||
// This could be a closure, but then implementing derive trait
|
||||
// becomes hacky (and it gets allocated).
|
||||
#[derive(Debug)]
|
||||
pub enum BuiltinLintDiagnostics {
|
||||
pub enum BuiltinLintDiag {
|
||||
Normal,
|
||||
AbsPathWithModule(Span),
|
||||
ProcMacroDeriveResolutionFallback(Span),
|
||||
@ -684,7 +684,7 @@ pub struct BufferedEarlyLint {
|
||||
pub lint_id: LintId,
|
||||
|
||||
/// Customization of the `Diag<'_>` for the lint.
|
||||
pub diagnostic: BuiltinLintDiagnostics,
|
||||
pub diagnostic: BuiltinLintDiag,
|
||||
}
|
||||
|
||||
#[derive(Default, Debug)]
|
||||
@ -704,7 +704,7 @@ pub fn add_lint(
|
||||
node_id: NodeId,
|
||||
span: MultiSpan,
|
||||
msg: impl Into<DiagMessage>,
|
||||
diagnostic: BuiltinLintDiagnostics,
|
||||
diagnostic: BuiltinLintDiag,
|
||||
) {
|
||||
let lint_id = LintId::of(lint);
|
||||
let msg = msg.into();
|
||||
@ -723,7 +723,7 @@ pub fn buffer_lint(
|
||||
sp: impl Into<MultiSpan>,
|
||||
msg: impl Into<DiagMessage>,
|
||||
) {
|
||||
self.add_lint(lint, id, sp.into(), msg, BuiltinLintDiagnostics::Normal)
|
||||
self.add_lint(lint, id, sp.into(), msg, BuiltinLintDiag::Normal)
|
||||
}
|
||||
|
||||
pub fn buffer_lint_with_diagnostic(
|
||||
@ -732,7 +732,7 @@ pub fn buffer_lint_with_diagnostic(
|
||||
id: NodeId,
|
||||
sp: impl Into<MultiSpan>,
|
||||
msg: impl Into<DiagMessage>,
|
||||
diagnostic: BuiltinLintDiagnostics,
|
||||
diagnostic: BuiltinLintDiag,
|
||||
) {
|
||||
self.add_lint(lint, id, sp.into(), msg, diagnostic)
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
use rustc_hir::{self as hir, HirId};
|
||||
use rustc_middle::ty::print::with_no_trimmed_paths;
|
||||
use rustc_session::lint::builtin::{DEPRECATED, DEPRECATED_IN_FUTURE, SOFT_UNSTABLE};
|
||||
use rustc_session::lint::{BuiltinLintDiagnostics, Level, Lint, LintBuffer};
|
||||
use rustc_session::lint::{BuiltinLintDiag, Level, Lint, LintBuffer};
|
||||
use rustc_session::parse::feature_err_issue;
|
||||
use rustc_session::Session;
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
@ -199,7 +199,7 @@ pub fn early_report_deprecation(
|
||||
return;
|
||||
}
|
||||
|
||||
let diag = BuiltinLintDiagnostics::DeprecatedMacro(suggestion, span);
|
||||
let diag = BuiltinLintDiag::DeprecatedMacro(suggestion, span);
|
||||
lint_buffer.buffer_lint_with_diagnostic(lint, node_id, span, message, diag);
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
use rustc_session::lint::builtin::{
|
||||
RUST_2021_PREFIXES_INCOMPATIBLE_SYNTAX, TEXT_DIRECTION_CODEPOINT_IN_COMMENT,
|
||||
};
|
||||
use rustc_session::lint::BuiltinLintDiagnostics;
|
||||
use rustc_session::lint::BuiltinLintDiag;
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_span::{edition::Edition, BytePos, Pos, Span};
|
||||
@ -355,7 +355,7 @@ fn lint_unicode_text_flow(&self, start: BytePos) {
|
||||
span,
|
||||
ast::CRATE_NODE_ID,
|
||||
"unicode codepoint changing visible direction of text present in comment",
|
||||
BuiltinLintDiagnostics::UnicodeTextFlow(span, content.to_string()),
|
||||
BuiltinLintDiag::UnicodeTextFlow(span, content.to_string()),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -685,7 +685,7 @@ fn report_unknown_prefix(&self, start: BytePos) {
|
||||
prefix_span,
|
||||
ast::CRATE_NODE_ID,
|
||||
format!("prefix `{prefix}` is unknown"),
|
||||
BuiltinLintDiagnostics::ReservedPrefix(prefix_span),
|
||||
BuiltinLintDiag::ReservedPrefix(prefix_span),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@
|
||||
use rustc_macros::Subdiagnostic;
|
||||
use rustc_session::errors::{report_lit_error, ExprParenthesesNeeded};
|
||||
use rustc_session::lint::builtin::BREAK_WITH_LABEL_AND_LOOP;
|
||||
use rustc_session::lint::BuiltinLintDiagnostics;
|
||||
use rustc_session::lint::BuiltinLintDiag;
|
||||
use rustc_span::source_map::{self, Spanned};
|
||||
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
||||
use rustc_span::{BytePos, ErrorGuaranteed, Pos, Span};
|
||||
@ -1880,7 +1880,7 @@ fn parse_expr_break(&mut self) -> PResult<'a, P<Expr>> {
|
||||
lo.to(expr.span),
|
||||
ast::CRATE_NODE_ID,
|
||||
"this labeled break expression is easy to confuse with an unlabeled break with a labeled value expression",
|
||||
BuiltinLintDiagnostics::BreakWithLabelAndLoop(expr.span),
|
||||
BuiltinLintDiag::BreakWithLabelAndLoop(expr.span),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
use rustc_errors::{pluralize, MultiSpan};
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_session::lint::builtin::{MACRO_USE_EXTERN_CRATE, UNUSED_EXTERN_CRATES, UNUSED_IMPORTS};
|
||||
use rustc_session::lint::BuiltinLintDiagnostics;
|
||||
use rustc_session::lint::BuiltinLintDiag;
|
||||
use rustc_span::symbol::{kw, Ident};
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
|
||||
@ -412,7 +412,7 @@ pub(crate) fn check_unused(&mut self, krate: &ast::Crate) {
|
||||
unused.use_tree_id,
|
||||
ms,
|
||||
msg,
|
||||
BuiltinLintDiagnostics::UnusedImports(fix_msg.into(), fixes, test_module_span),
|
||||
BuiltinLintDiag::UnusedImports(fix_msg.into(), fixes, test_module_span),
|
||||
);
|
||||
}
|
||||
|
||||
@ -428,7 +428,7 @@ pub(crate) fn check_unused(&mut self, krate: &ast::Crate) {
|
||||
extern_crate.id,
|
||||
span,
|
||||
"unused extern crate",
|
||||
BuiltinLintDiagnostics::UnusedExternCrate {
|
||||
BuiltinLintDiag::UnusedExternCrate {
|
||||
removal_span: extern_crate.span_with_attributes,
|
||||
},
|
||||
);
|
||||
@ -481,7 +481,7 @@ pub(crate) fn check_unused(&mut self, krate: &ast::Crate) {
|
||||
extern_crate.id,
|
||||
extern_crate.span,
|
||||
"`extern crate` is not idiomatic in the new edition",
|
||||
BuiltinLintDiagnostics::ExternCrateNotIdiomatic { vis_span, ident_span },
|
||||
BuiltinLintDiag::ExternCrateNotIdiomatic { vis_span, ident_span },
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
use rustc_session::lint::builtin::ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE;
|
||||
use rustc_session::lint::builtin::AMBIGUOUS_GLOB_IMPORTS;
|
||||
use rustc_session::lint::builtin::MACRO_EXPANDED_MACRO_EXPORTS_ACCESSED_BY_ABSOLUTE_PATHS;
|
||||
use rustc_session::lint::{AmbiguityErrorDiag, BuiltinLintDiagnostics};
|
||||
use rustc_session::lint::{AmbiguityErrorDiag, BuiltinLintDiag};
|
||||
use rustc_session::Session;
|
||||
use rustc_span::edit_distance::find_best_match_for_name;
|
||||
use rustc_span::edition::Edition;
|
||||
@ -138,7 +138,7 @@ pub(crate) fn report_errors(&mut self, krate: &Crate) {
|
||||
CRATE_NODE_ID,
|
||||
span_use,
|
||||
msg,
|
||||
BuiltinLintDiagnostics::MacroExpandedMacroExportsAccessedByAbsolutePaths(span_def),
|
||||
BuiltinLintDiag::MacroExpandedMacroExportsAccessedByAbsolutePaths(span_def),
|
||||
);
|
||||
}
|
||||
|
||||
@ -153,7 +153,7 @@ pub(crate) fn report_errors(&mut self, krate: &Crate) {
|
||||
import.root_id,
|
||||
ambiguity_error.ident.span,
|
||||
diag.msg.to_string(),
|
||||
BuiltinLintDiagnostics::AmbiguousGlobImports { diag },
|
||||
BuiltinLintDiag::AmbiguousGlobImports { diag },
|
||||
);
|
||||
} else {
|
||||
let mut err = struct_span_code_err!(self.dcx(), diag.span, E0659, "{}", &diag.msg);
|
||||
@ -525,7 +525,7 @@ pub(crate) fn lint_if_path_starts_with_module(
|
||||
}
|
||||
}
|
||||
|
||||
let diag = BuiltinLintDiagnostics::AbsPathWithModule(root_span);
|
||||
let diag = BuiltinLintDiag::AbsPathWithModule(root_span);
|
||||
self.lint_buffer.buffer_lint_with_diagnostic(
|
||||
ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE,
|
||||
node_id,
|
||||
|
@ -4,7 +4,7 @@
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::ty;
|
||||
use rustc_session::lint::builtin::PROC_MACRO_DERIVE_RESOLUTION_FALLBACK;
|
||||
use rustc_session::lint::BuiltinLintDiagnostics;
|
||||
use rustc_session::lint::BuiltinLintDiag;
|
||||
use rustc_span::def_id::LocalDefId;
|
||||
use rustc_span::hygiene::{ExpnId, ExpnKind, LocalExpnId, MacroKind, SyntaxContext};
|
||||
use rustc_span::symbol::{kw, Ident};
|
||||
@ -530,7 +530,7 @@ struct Flags: u8 {
|
||||
ns.descr(),
|
||||
ident
|
||||
),
|
||||
BuiltinLintDiagnostics::ProcMacroDeriveResolutionFallback(
|
||||
BuiltinLintDiag::ProcMacroDeriveResolutionFallback(
|
||||
orig_ident.span,
|
||||
),
|
||||
);
|
||||
|
@ -27,7 +27,7 @@
|
||||
AMBIGUOUS_GLOB_REEXPORTS, HIDDEN_GLOB_REEXPORTS, PUB_USE_OF_PRIVATE_EXTERN_CRATE,
|
||||
UNUSED_IMPORTS,
|
||||
};
|
||||
use rustc_session::lint::BuiltinLintDiagnostics;
|
||||
use rustc_session::lint::BuiltinLintDiag;
|
||||
use rustc_span::edit_distance::find_best_match_for_name;
|
||||
use rustc_span::hygiene::LocalExpnId;
|
||||
use rustc_span::symbol::{kw, Ident, Symbol};
|
||||
@ -618,7 +618,7 @@ pub(crate) fn check_hidden_glob_reexports(
|
||||
import.root_id,
|
||||
import.root_span,
|
||||
"ambiguous glob re-exports",
|
||||
BuiltinLintDiagnostics::AmbiguousGlobReexports {
|
||||
BuiltinLintDiag::AmbiguousGlobReexports {
|
||||
name: key.ident.to_string(),
|
||||
namespace: key.ns.descr().to_string(),
|
||||
first_reexport_span: import.root_span,
|
||||
@ -654,7 +654,7 @@ pub(crate) fn check_hidden_glob_reexports(
|
||||
binding_id,
|
||||
binding.span,
|
||||
"private item shadows public glob re-export",
|
||||
BuiltinLintDiagnostics::HiddenGlobReexports {
|
||||
BuiltinLintDiag::HiddenGlobReexports {
|
||||
name: key.ident.name.to_string(),
|
||||
namespace: key.ns.descr().to_owned(),
|
||||
glob_reexport_span: glob_binding.span,
|
||||
@ -1006,7 +1006,7 @@ fn finalize_import(&mut self, import: Import<'a>) -> Option<UnresolvedImportErro
|
||||
id,
|
||||
import.span,
|
||||
msg,
|
||||
BuiltinLintDiagnostics::RedundantImportVisibility {
|
||||
BuiltinLintDiag::RedundantImportVisibility {
|
||||
max_vis: max_vis.to_string(def_id, self.tcx),
|
||||
span: import.span,
|
||||
},
|
||||
@ -1373,7 +1373,7 @@ pub(crate) fn check_for_redundant_imports(&mut self, import: Import<'a>) {
|
||||
id,
|
||||
import.span,
|
||||
format!("the item `{source}` is imported redundantly"),
|
||||
BuiltinLintDiagnostics::RedundantImport(redundant_spans, source),
|
||||
BuiltinLintDiag::RedundantImport(redundant_spans, source),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1660,7 +1660,7 @@ fn resolve_anonymous_lifetime(&mut self, lifetime: &Lifetime, elided: bool) {
|
||||
node_id,
|
||||
lifetime.ident.span,
|
||||
msg,
|
||||
lint::BuiltinLintDiagnostics::AssociatedConstElidedLifetime {
|
||||
lint::BuiltinLintDiag::AssociatedConstElidedLifetime {
|
||||
elided,
|
||||
span: lifetime.ident.span,
|
||||
},
|
||||
@ -1950,7 +1950,7 @@ fn resolve_elided_lifetimes_in_path(
|
||||
segment_id,
|
||||
elided_lifetime_span,
|
||||
"hidden lifetime parameters in types are deprecated",
|
||||
lint::BuiltinLintDiagnostics::ElidedLifetimesInPaths(
|
||||
lint::BuiltinLintDiag::ElidedLifetimesInPaths(
|
||||
expected_lifetimes,
|
||||
path_span,
|
||||
!segment.has_generic_args,
|
||||
@ -4176,7 +4176,7 @@ fn resolve_qpath(
|
||||
finalize.node_id,
|
||||
finalize.path_span,
|
||||
"unnecessary qualification",
|
||||
lint::BuiltinLintDiagnostics::UnusedQualifications {
|
||||
lint::BuiltinLintDiag::UnusedQualifications {
|
||||
removal_span: finalize.path_span.until(unqualified.ident.span),
|
||||
},
|
||||
);
|
||||
|
@ -2658,7 +2658,7 @@ pub(crate) fn maybe_report_lifetime_uses(
|
||||
param.id,
|
||||
param.ident.span,
|
||||
format!("lifetime parameter `{}` only used once", param.ident),
|
||||
lint::BuiltinLintDiagnostics::SingleUseLifetime {
|
||||
lint::BuiltinLintDiag::SingleUseLifetime {
|
||||
param_span: param.ident.span,
|
||||
use_span: Some((use_span, elidable)),
|
||||
deletion_span,
|
||||
@ -2676,7 +2676,7 @@ pub(crate) fn maybe_report_lifetime_uses(
|
||||
param.id,
|
||||
param.ident.span,
|
||||
format!("lifetime parameter `{}` never used", param.ident),
|
||||
lint::BuiltinLintDiagnostics::SingleUseLifetime {
|
||||
lint::BuiltinLintDiag::SingleUseLifetime {
|
||||
param_span: param.ident.span,
|
||||
use_span: None,
|
||||
deletion_span,
|
||||
|
@ -27,7 +27,7 @@
|
||||
use rustc_session::lint::builtin::UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES;
|
||||
use rustc_session::lint::builtin::{LEGACY_DERIVE_HELPERS, SOFT_UNSTABLE};
|
||||
use rustc_session::lint::builtin::{UNUSED_MACROS, UNUSED_MACRO_RULES};
|
||||
use rustc_session::lint::BuiltinLintDiagnostics;
|
||||
use rustc_session::lint::BuiltinLintDiag;
|
||||
use rustc_session::parse::feature_err;
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::hygiene::{self, ExpnData, ExpnKind, LocalExpnId};
|
||||
@ -810,7 +810,7 @@ pub(crate) fn finalize_macro_resolutions(&mut self, krate: &Crate) {
|
||||
node_id,
|
||||
ident.span,
|
||||
"derive helper attribute is used before it is introduced",
|
||||
BuiltinLintDiagnostics::LegacyDeriveHelpers(binding.span),
|
||||
BuiltinLintDiag::LegacyDeriveHelpers(binding.span),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
SuggestUpgradeCompiler,
|
||||
};
|
||||
use crate::lint::{
|
||||
builtin::UNSTABLE_SYNTAX_PRE_EXPANSION, BufferedEarlyLint, BuiltinLintDiagnostics, Lint, LintId,
|
||||
builtin::UNSTABLE_SYNTAX_PRE_EXPANSION, BufferedEarlyLint, BuiltinLintDiag, Lint, LintId,
|
||||
};
|
||||
use crate::Session;
|
||||
use rustc_ast::node_id::NodeId;
|
||||
@ -298,7 +298,7 @@ pub fn buffer_lint(
|
||||
node_id,
|
||||
msg: msg.into(),
|
||||
lint_id: LintId::of(lint),
|
||||
diagnostic: BuiltinLintDiagnostics::Normal,
|
||||
diagnostic: BuiltinLintDiag::Normal,
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -309,7 +309,7 @@ pub fn buffer_lint_with_diagnostic(
|
||||
span: impl Into<MultiSpan>,
|
||||
node_id: NodeId,
|
||||
msg: impl Into<DiagMessage>,
|
||||
diagnostic: BuiltinLintDiagnostics,
|
||||
diagnostic: BuiltinLintDiag,
|
||||
) {
|
||||
self.buffered_lints.with_lock(|buffered_lints| {
|
||||
buffered_lints.push(BufferedEarlyLint {
|
||||
|
Loading…
Reference in New Issue
Block a user