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

@ -4,9 +4,7 @@ use std::collections::BTreeMap;
use rustc_abi::{FieldIdx, VariantIdx};
use rustc_data_structures::fx::FxIndexMap;
use rustc_errors::{
Applicability, Diag, DiagMessage, EmissionGuarantee, MultiSpan, inline_fluent, listify,
};
use rustc_errors::{Applicability, Diag, DiagMessage, EmissionGuarantee, MultiSpan, listify, msg};
use rustc_hir::def::{CtorKind, Namespace};
use rustc_hir::{
self as hir, CoroutineKind, GenericBound, LangItem, WhereBoundPredicate, WherePredicateKind,
@ -1313,7 +1311,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
let mut span: MultiSpan = spans.clone().into();
err.arg("ty", param_ty.to_string());
let msg = err.dcx.eagerly_translate_to_string(
inline_fluent!("`{$ty}` is made to be an `FnOnce` closure here"),
msg!("`{$ty}` is made to be an `FnOnce` closure here"),
err.args.iter(),
);
err.remove_arg("ty");
@ -1322,12 +1320,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
}
span.push_span_label(
fn_call_span,
inline_fluent!("this value implements `FnOnce`, which causes it to be moved when called"),
);
err.span_note(
span,
inline_fluent!("`FnOnce` closures can only be called once"),
msg!("this value implements `FnOnce`, which causes it to be moved when called"),
);
err.span_note(span, msg!("`FnOnce` closures can only be called once"));
} else {
err.subdiagnostic(CaptureReasonNote::FnOnceMoveInCall { var_span });
}
@ -1573,6 +1568,5 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
}
}
const LIMITATION_NOTE: DiagMessage = inline_fluent!(
"due to a current limitation of the type system, this implies a `'static` lifetime"
);
const LIMITATION_NOTE: DiagMessage =
msg!("due to a current limitation of the type system, this implies a `'static` lifetime");

View file

@ -1,7 +1,7 @@
//! Error reporting machinery for lifetime errors.
use rustc_data_structures::fx::FxIndexSet;
use rustc_errors::{Applicability, Diag, ErrorGuaranteed, MultiSpan, inline_fluent};
use rustc_errors::{Applicability, Diag, ErrorGuaranteed, MultiSpan, msg};
use rustc_hir as hir;
use rustc_hir::GenericBound::Trait;
use rustc_hir::QPath::Resolved;
@ -291,7 +291,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
if suggestions.len() > 0 {
suggestions.dedup();
diag.multipart_suggestion_verbose(
inline_fluent!("consider restricting the type parameter to the `'static` lifetime"),
msg!("consider restricting the type parameter to the `'static` lifetime"),
suggestions,
Applicability::MaybeIncorrect,
);
@ -982,18 +982,16 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
let mut multi_span: MultiSpan = vec![*span].into();
multi_span.push_span_label(
*span,
inline_fluent!("this has an implicit `'static` lifetime requirement"),
msg!("this has an implicit `'static` lifetime requirement"),
);
multi_span.push_span_label(
ident.span,
inline_fluent!(
"calling this method introduces the `impl`'s `'static` requirement"
),
msg!("calling this method introduces the `impl`'s `'static` requirement"),
);
err.subdiagnostic(RequireStaticErr::UsedImpl { multi_span });
err.span_suggestion_verbose(
span.shrink_to_hi(),
inline_fluent!("consider relaxing the implicit `'static` requirement"),
msg!("consider relaxing the implicit `'static` requirement"),
" + '_",
Applicability::MaybeIncorrect,
);
@ -1156,7 +1154,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
if ocx.evaluate_obligations_error_on_ambiguity().is_empty() && count > 0 {
diag.span_suggestion_verbose(
tcx.hir_body(*body).value.peel_blocks().span.shrink_to_lo(),
inline_fluent!("dereference the return value"),
msg!("dereference the return value"),
"*".repeat(count),
Applicability::MachineApplicable,
);
@ -1200,7 +1198,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
if let Some(closure_span) = closure_span {
diag.span_suggestion_verbose(
closure_span,
inline_fluent!("consider adding 'move' keyword before the nested closure"),
msg!("consider adding 'move' keyword before the nested closure"),
"move ",
Applicability::MaybeIncorrect,
);