Use DiagnosticMessage for BufferedEarlyLint.msg
This commit is contained in:
parent
d6fdf14eb7
commit
80451de390
3 changed files with 6 additions and 6 deletions
|
@ -1176,7 +1176,7 @@ fn create_lints_for_named_arguments_used_positionally(cx: &mut Context<'_, '_>)
|
||||||
|
|
||||||
cx.ecx.buffered_early_lint.push(BufferedEarlyLint {
|
cx.ecx.buffered_early_lint.push(BufferedEarlyLint {
|
||||||
span: MultiSpan::from_span(named_arg.positional_named_arg_span),
|
span: MultiSpan::from_span(named_arg.positional_named_arg_span),
|
||||||
msg: msg.clone(),
|
msg: msg.clone().into(),
|
||||||
node_id: ast::CRATE_NODE_ID,
|
node_id: ast::CRATE_NODE_ID,
|
||||||
lint_id: LintId::of(&NAMED_ARGUMENTS_USED_POSITIONALLY),
|
lint_id: LintId::of(&NAMED_ARGUMENTS_USED_POSITIONALLY),
|
||||||
diagnostic: BuiltinLintDiagnostics::NamedArgumentUsedPositionally {
|
diagnostic: BuiltinLintDiagnostics::NamedArgumentUsedPositionally {
|
||||||
|
|
|
@ -45,7 +45,7 @@ impl<'a, T: EarlyLintPass> EarlyContextAndPass<'a, T> {
|
||||||
lint_id.lint,
|
lint_id.lint,
|
||||||
Some(span),
|
Some(span),
|
||||||
|lint| {
|
|lint| {
|
||||||
lint.build(&msg).emit();
|
lint.build(msg).emit();
|
||||||
},
|
},
|
||||||
diagnostic,
|
diagnostic,
|
||||||
);
|
);
|
||||||
|
|
|
@ -9,7 +9,7 @@ pub use self::Level::*;
|
||||||
use rustc_ast::node_id::{NodeId, NodeMap};
|
use rustc_ast::node_id::{NodeId, NodeMap};
|
||||||
use rustc_ast::{AttrId, Attribute};
|
use rustc_ast::{AttrId, Attribute};
|
||||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey};
|
use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey};
|
||||||
use rustc_error_messages::MultiSpan;
|
use rustc_error_messages::{MultiSpan, DiagnosticMessage};
|
||||||
use rustc_hir::HashStableContext;
|
use rustc_hir::HashStableContext;
|
||||||
use rustc_hir::HirId;
|
use rustc_hir::HirId;
|
||||||
use rustc_span::edition::Edition;
|
use rustc_span::edition::Edition;
|
||||||
|
@ -491,7 +491,7 @@ pub struct BufferedEarlyLint {
|
||||||
pub span: MultiSpan,
|
pub span: MultiSpan,
|
||||||
|
|
||||||
/// The lint message.
|
/// The lint message.
|
||||||
pub msg: String,
|
pub msg: DiagnosticMessage,
|
||||||
|
|
||||||
/// The `NodeId` of the AST node that generated the lint.
|
/// The `NodeId` of the AST node that generated the lint.
|
||||||
pub node_id: NodeId,
|
pub node_id: NodeId,
|
||||||
|
@ -520,11 +520,11 @@ impl LintBuffer {
|
||||||
lint: &'static Lint,
|
lint: &'static Lint,
|
||||||
node_id: NodeId,
|
node_id: NodeId,
|
||||||
span: MultiSpan,
|
span: MultiSpan,
|
||||||
msg: &str,
|
msg: impl Into<DiagnosticMessage>,
|
||||||
diagnostic: BuiltinLintDiagnostics,
|
diagnostic: BuiltinLintDiagnostics,
|
||||||
) {
|
) {
|
||||||
let lint_id = LintId::of(lint);
|
let lint_id = LintId::of(lint);
|
||||||
let msg = msg.to_string();
|
let msg = msg.into();
|
||||||
self.add_early_lint(BufferedEarlyLint { lint_id, node_id, span, msg, diagnostic });
|
self.add_early_lint(BufferedEarlyLint { lint_id, node_id, span, msg, diagnostic });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue