Skip to content

Commit 80451de

Browse files
committed
Use DiagnosticMessage for BufferedEarlyLint.msg
1 parent d6fdf14 commit 80451de

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

compiler/rustc_builtin_macros/src/format.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,7 @@ fn create_lints_for_named_arguments_used_positionally(cx: &mut Context<'_, '_>)
11761176

11771177
cx.ecx.buffered_early_lint.push(BufferedEarlyLint {
11781178
span: MultiSpan::from_span(named_arg.positional_named_arg_span),
1179-
msg: msg.clone(),
1179+
msg: msg.clone().into(),
11801180
node_id: ast::CRATE_NODE_ID,
11811181
lint_id: LintId::of(&NAMED_ARGUMENTS_USED_POSITIONALLY),
11821182
diagnostic: BuiltinLintDiagnostics::NamedArgumentUsedPositionally {

compiler/rustc_lint/src/early.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl<'a, T: EarlyLintPass> EarlyContextAndPass<'a, T> {
4545
lint_id.lint,
4646
Some(span),
4747
|lint| {
48-
lint.build(&msg).emit();
48+
lint.build(msg).emit();
4949
},
5050
diagnostic,
5151
);

compiler/rustc_lint_defs/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub use self::Level::*;
99
use rustc_ast::node_id::{NodeId, NodeMap};
1010
use rustc_ast::{AttrId, Attribute};
1111
use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey};
12-
use rustc_error_messages::MultiSpan;
12+
use rustc_error_messages::{MultiSpan, DiagnosticMessage};
1313
use rustc_hir::HashStableContext;
1414
use rustc_hir::HirId;
1515
use rustc_span::edition::Edition;
@@ -491,7 +491,7 @@ pub struct BufferedEarlyLint {
491491
pub span: MultiSpan,
492492

493493
/// The lint message.
494-
pub msg: String,
494+
pub msg: DiagnosticMessage,
495495

496496
/// The `NodeId` of the AST node that generated the lint.
497497
pub node_id: NodeId,
@@ -520,11 +520,11 @@ impl LintBuffer {
520520
lint: &'static Lint,
521521
node_id: NodeId,
522522
span: MultiSpan,
523-
msg: &str,
523+
msg: impl Into<DiagnosticMessage>,
524524
diagnostic: BuiltinLintDiagnostics,
525525
) {
526526
let lint_id = LintId::of(lint);
527-
let msg = msg.to_string();
527+
let msg = msg.into();
528528
self.add_early_lint(BufferedEarlyLint { lint_id, node_id, span, msg, diagnostic });
529529
}
530530

0 commit comments

Comments
 (0)