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