Rename inline_fluent! to msg!

This commit is contained in:
Jonathan Brouwer 2026-02-14 13:47:52 +01:00
parent 3f808f29e6
commit 018a5efcf7
No known key found for this signature in database
GPG key ID: 13619B051B673C52
64 changed files with 647 additions and 840 deletions

View file

@ -1,7 +1,5 @@
use rustc_errors::codes::*;
use rustc_errors::{
Applicability, Diag, EmissionGuarantee, LintDiagnostic, Subdiagnostic, inline_fluent,
};
use rustc_errors::{Applicability, Diag, EmissionGuarantee, LintDiagnostic, Subdiagnostic, msg};
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
use rustc_middle::mir::AssertKind;
use rustc_middle::query::Key;
@ -135,10 +133,10 @@ impl<'a, P: std::fmt::Debug> LintDiagnostic<'a, ()> for AssertLint<P> {
fn decorate_lint<'b>(self, diag: &'b mut Diag<'a, ()>) {
diag.primary_message(match self.lint_kind {
AssertLintKind::ArithmeticOverflow => {
inline_fluent!("this arithmetic operation will overflow")
msg!("this arithmetic operation will overflow")
}
AssertLintKind::UnconditionalPanic => {
inline_fluent!("this operation will panic at runtime")
msg!("this operation will panic at runtime")
}
});
let label = self.assert_kind.diagnostic_message();
@ -295,12 +293,10 @@ impl Subdiagnostic for UnusedVariableStringInterp {
fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
diag.span_label(
self.lit,
inline_fluent!(
"you might have meant to use string interpolation in this string literal"
),
msg!("you might have meant to use string interpolation in this string literal"),
);
diag.multipart_suggestion(
inline_fluent!("string interpolation only works in `format!` invocations"),
msg!("string interpolation only works in `format!` invocations"),
vec![
(self.lit.shrink_to_lo(), String::from("format!(")),
(self.lit.shrink_to_hi(), String::from(")")),
@ -337,17 +333,14 @@ pub(crate) struct MustNotSupend<'a, 'tcx> {
// Needed for def_path_str
impl<'a> LintDiagnostic<'a, ()> for MustNotSupend<'_, '_> {
fn decorate_lint<'b>(self, diag: &'b mut rustc_errors::Diag<'a, ()>) {
diag.primary_message(inline_fluent!(
diag.primary_message(msg!(
"{$pre}`{$def_path}`{$post} held across a suspend point, but should not be"
));
diag.span_label(
self.yield_sp,
inline_fluent!("the value is held across this suspend point"),
);
diag.span_label(self.yield_sp, msg!("the value is held across this suspend point"));
if let Some(reason) = self.reason {
diag.subdiagnostic(reason);
}
diag.span_help(self.src_sp, inline_fluent!("consider using a block (`{\"{ ... }\"}`) to shrink the value's scope, ending before the suspend point"));
diag.span_help(self.src_sp, msg!("consider using a block (`{\"{ ... }\"}`) to shrink the value's scope, ending before the suspend point"));
diag.arg("pre", self.pre);
diag.arg("def_path", self.tcx.def_path_str(self.def_id));
diag.arg("post", self.post);

View file

@ -5,7 +5,7 @@ use std::rc::Rc;
use itertools::Itertools as _;
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap};
use rustc_data_structures::unord::{UnordMap, UnordSet};
use rustc_errors::{Subdiagnostic, inline_fluent};
use rustc_errors::{Subdiagnostic, msg};
use rustc_hir::CRATE_HIR_ID;
use rustc_hir::def_id::LocalDefId;
use rustc_index::bit_set::MixedBitSet;
@ -531,7 +531,7 @@ impl Subdiagnostic for LocalLabel<'_> {
diag.arg("is_generated_name", self.is_generated_name);
diag.remove_arg("is_dropped_first_edition_2024");
diag.arg("is_dropped_first_edition_2024", self.is_dropped_first_edition_2024);
let msg = diag.eagerly_translate(inline_fluent!(
let msg = diag.eagerly_translate(msg!(
"{$is_generated_name ->
[true] this value will be stored in a temporary; let us call it `{$name}`
*[false] `{$name}` calls a custom destructor
@ -542,7 +542,7 @@ impl Subdiagnostic for LocalLabel<'_> {
dtor.add_to_diag(diag);
}
let msg =
diag.eagerly_translate(inline_fluent!(
diag.eagerly_translate(msg!(
"{$is_dropped_first_edition_2024 ->
[true] up until Edition 2021 `{$name}` is dropped last but will be dropped earlier in Edition 2024
*[false] `{$name}` will be dropped later as of Edition 2024