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

@ -6,9 +6,7 @@ use rustc_macros::Subdiagnostic;
use rustc_span::{Span, Symbol};
use crate::diagnostic::DiagLocation;
use crate::{
Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, Subdiagnostic, inline_fluent,
};
use crate::{Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, Subdiagnostic, msg};
impl IntoDiagArg for DiagLocation {
fn into_diag_arg(self, _: &mut Option<std::path::PathBuf>) -> DiagArgValue {
@ -43,24 +41,24 @@ impl<G: EmissionGuarantee> Diagnostic<'_, G> for TargetDataLayoutErrors<'_> {
fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
match self {
TargetDataLayoutErrors::InvalidAddressSpace { addr_space, err, cause } => {
Diag::new(dcx, level, inline_fluent!("invalid address space `{$addr_space}` for `{$cause}` in \"data-layout\": {$err}"))
Diag::new(dcx, level, msg!("invalid address space `{$addr_space}` for `{$cause}` in \"data-layout\": {$err}"))
.with_arg("addr_space", addr_space)
.with_arg("cause", cause)
.with_arg("err", err)
}
TargetDataLayoutErrors::InvalidBits { kind, bit, cause, err } => {
Diag::new(dcx, level, inline_fluent!("invalid {$kind} `{$bit}` for `{$cause}` in \"data-layout\": {$err}"))
Diag::new(dcx, level, msg!("invalid {$kind} `{$bit}` for `{$cause}` in \"data-layout\": {$err}"))
.with_arg("kind", kind)
.with_arg("bit", bit)
.with_arg("cause", cause)
.with_arg("err", err)
}
TargetDataLayoutErrors::MissingAlignment { cause } => {
Diag::new(dcx, level, inline_fluent!("missing alignment for `{$cause}` in \"data-layout\""))
Diag::new(dcx, level, msg!("missing alignment for `{$cause}` in \"data-layout\""))
.with_arg("cause", cause)
}
TargetDataLayoutErrors::InvalidAlignment { cause, err } => {
Diag::new(dcx, level, inline_fluent!(
Diag::new(dcx, level, msg!(
"invalid alignment for `{$cause}` in \"data-layout\": `{$align}` is {$err_kind ->
[not_power_of_two] not a power of 2
[too_large] too large
@ -72,21 +70,21 @@ impl<G: EmissionGuarantee> Diagnostic<'_, G> for TargetDataLayoutErrors<'_> {
.with_arg("align", err.align())
}
TargetDataLayoutErrors::InconsistentTargetArchitecture { dl, target } => {
Diag::new(dcx, level, inline_fluent!(
Diag::new(dcx, level, msg!(
"inconsistent target specification: \"data-layout\" claims architecture is {$dl}-endian, while \"target-endian\" is `{$target}`"
))
.with_arg("dl", dl).with_arg("target", target)
}
TargetDataLayoutErrors::InconsistentTargetPointerWidth { pointer_size, target } => {
Diag::new(dcx, level, inline_fluent!(
Diag::new(dcx, level, msg!(
"inconsistent target specification: \"data-layout\" claims pointers are {$pointer_size}-bit, while \"target-pointer-width\" is `{$target}`"
)).with_arg("pointer_size", pointer_size).with_arg("target", target)
}
TargetDataLayoutErrors::InvalidBitsSize { err } => {
Diag::new(dcx, level, inline_fluent!("{$err}")).with_arg("err", err)
Diag::new(dcx, level, msg!("{$err}")).with_arg("err", err)
}
TargetDataLayoutErrors::UnknownPointerSpecification { err } => {
Diag::new(dcx, level, inline_fluent!("unknown pointer specification `{$err}` in datalayout string"))
Diag::new(dcx, level, msg!("unknown pointer specification `{$err}` in datalayout string"))
.with_arg("err", err)
}
}

View file

@ -61,7 +61,7 @@ pub use rustc_error_messages::{
use rustc_hashes::Hash128;
use rustc_lint_defs::LintExpectationId;
pub use rustc_lint_defs::{Applicability, listify, pluralize};
pub use rustc_macros::inline_fluent;
pub use rustc_macros::msg;
use rustc_macros::{Decodable, Encodable};
pub use rustc_span::ErrorGuaranteed;
pub use rustc_span::fatal_error::{FatalError, FatalErrorMarker, catch_fatal_errors};
@ -1514,7 +1514,7 @@ impl DiagCtxtInner {
// the usual `Diag`/`DiagCtxt` level, so we must augment `bug`
// in a lower-level fashion.
bug.arg("level", bug.level);
let msg = inline_fluent!(
let msg = msg!(
"`flushed_delayed` got diagnostic with level {$level}, instead of the expected `DelayedBug`"
);
let msg = self.eagerly_translate_for_subdiag(&bug, msg); // after the `arg` call
@ -1558,13 +1558,13 @@ impl DelayedDiagInner {
// lower-level fashion.
let mut diag = self.inner;
let msg = match self.note.status() {
BacktraceStatus::Captured => inline_fluent!(
BacktraceStatus::Captured => msg!(
"delayed at {$emitted_at}
{$note}"
),
// Avoid the needless newline when no backtrace has been captured,
// the display impl should just be a single line.
_ => inline_fluent!("delayed at {$emitted_at} - {$note}"),
_ => msg!("delayed at {$emitted_at} - {$note}"),
};
diag.arg("emitted_at", diag.emitted_at.clone());
diag.arg("note", self.note);