Skip to content

Commit e7ad0ed

Browse files
Rename inline_fluent! to msg!
1 parent 07c72db commit e7ad0ed

File tree

66 files changed

+662
-857
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+662
-857
lines changed

compiler/rustc_ast_lowering/src/asm.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::fmt::Write;
33

44
use rustc_ast::*;
55
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap};
6-
use rustc_errors::inline_fluent;
6+
use rustc_errors::msg;
77
use rustc_hir as hir;
88
use rustc_hir::def::{DefKind, Res};
99
use rustc_session::parse::feature_err;
@@ -67,7 +67,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
6767
&self.tcx.sess,
6868
sym::asm_experimental_arch,
6969
sp,
70-
inline_fluent!("inline assembly is not stable yet on this architecture"),
70+
msg!("inline assembly is not stable yet on this architecture"),
7171
)
7272
.emit();
7373
}
@@ -84,7 +84,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
8484
&self.tcx.sess,
8585
sym::asm_unwind,
8686
sp,
87-
inline_fluent!("the `may_unwind` option is unstable"),
87+
msg!("the `may_unwind` option is unstable"),
8888
)
8989
.emit();
9090
}
@@ -499,9 +499,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
499499
sess,
500500
sym::asm_goto_with_outputs,
501501
*op_sp,
502-
inline_fluent!(
503-
"using both label and output operands for inline assembly is unstable"
504-
),
502+
msg!("using both label and output operands for inline assembly is unstable"),
505503
)
506504
.emit();
507505
}

compiler/rustc_ast_lowering/src/expr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::sync::Arc;
55
use rustc_ast::*;
66
use rustc_ast_pretty::pprust::expr_to_string;
77
use rustc_data_structures::stack::ensure_sufficient_stack;
8-
use rustc_errors::inline_fluent;
8+
use rustc_errors::msg;
99
use rustc_hir as hir;
1010
use rustc_hir::attrs::AttributeKind;
1111
use rustc_hir::def::{DefKind, Res};
@@ -1702,7 +1702,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
17021702
&self.tcx.sess,
17031703
sym::yield_expr,
17041704
span,
1705-
inline_fluent!("yield syntax is experimental"),
1705+
msg!("yield syntax is experimental"),
17061706
)
17071707
.emit();
17081708
}

compiler/rustc_ast_passes/src/errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use rustc_abi::ExternAbi;
44
use rustc_ast::ParamKindOrd;
55
use rustc_errors::codes::*;
6-
use rustc_errors::{Applicability, Diag, EmissionGuarantee, Subdiagnostic, inline_fluent};
6+
use rustc_errors::{Applicability, Diag, EmissionGuarantee, Subdiagnostic, msg};
77
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
88
use rustc_span::{Ident, Span, Symbol};
99

@@ -936,7 +936,7 @@ impl Subdiagnostic for StableFeature {
936936
fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
937937
diag.arg("name", self.name);
938938
diag.arg("since", self.since);
939-
diag.help(inline_fluent!("the feature `{$name}` has been stable since `{$since}` and no longer requires an attribute to enable"));
939+
diag.help(msg!("the feature `{$name}` has been stable since `{$since}` and no longer requires an attribute to enable"));
940940
}
941941
}
942942

compiler/rustc_ast_passes/src/feature_gate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use rustc_ast::visit::{self, AssocCtxt, FnCtxt, FnKind, Visitor};
22
use rustc_ast::{self as ast, AttrVec, NodeId, PatKind, attr, token};
3-
use rustc_errors::inline_fluent;
3+
use rustc_errors::msg;
44
use rustc_feature::{AttributeGate, BUILTIN_ATTRIBUTE_MAP, BuiltinAttribute, Features};
55
use rustc_session::Session;
66
use rustc_session::parse::{feature_err, feature_warn};
@@ -125,7 +125,7 @@ impl<'a> PostExpansionVisitor<'a> {
125125
&self,
126126
non_lifetime_binders,
127127
non_lt_param_spans,
128-
inline_fluent!("only lifetime parameters can be used in this context")
128+
msg!("only lifetime parameters can be used in this context")
129129
);
130130

131131
// FIXME(non_lifetime_binders): Const bound params are pretty broken.

compiler/rustc_attr_parsing/src/attributes/cfg.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::convert::identity;
33
use rustc_ast::token::Delimiter;
44
use rustc_ast::tokenstream::DelimSpan;
55
use rustc_ast::{AttrItem, Attribute, CRATE_NODE_ID, LitKind, ast, token};
6-
use rustc_errors::{Applicability, PResult, inline_fluent};
6+
use rustc_errors::{Applicability, PResult, msg};
77
use rustc_feature::{
88
AttrSuggestionStyle, AttributeTemplate, Features, GatedCfg, find_gated_cfg, template,
99
};
@@ -141,7 +141,7 @@ fn parse_cfg_entry_target<S: Stage>(
141141
cx.sess(),
142142
sym::cfg_target_compact,
143143
meta_span,
144-
inline_fluent!("compact `cfg(target(..))` is experimental and subject to change"),
144+
msg!("compact `cfg(target(..))` is experimental and subject to change"),
145145
)
146146
.emit();
147147
}

compiler/rustc_attr_parsing/src/attributes/link_attrs.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use rustc_errors::inline_fluent;
1+
use rustc_errors::msg;
22
use rustc_feature::Features;
33
use rustc_hir::attrs::AttributeKind::{LinkName, LinkOrdinal, LinkSection};
44
use rustc_hir::attrs::*;
@@ -316,7 +316,7 @@ impl LinkParser {
316316
sess,
317317
sym::raw_dylib_elf,
318318
nv.value_span,
319-
inline_fluent!("link kind `raw-dylib` is unstable on ELF platforms"),
319+
msg!("link kind `raw-dylib` is unstable on ELF platforms"),
320320
)
321321
.emit();
322322
} else {
@@ -331,7 +331,7 @@ impl LinkParser {
331331
sess,
332332
sym::link_arg_attribute,
333333
nv.value_span,
334-
inline_fluent!("link kind `link-arg` is unstable"),
334+
msg!("link kind `link-arg` is unstable"),
335335
)
336336
.emit();
337337
}
@@ -396,8 +396,7 @@ impl LinkParser {
396396
return true;
397397
};
398398
if !features.link_cfg() {
399-
feature_err(sess, sym::link_cfg, item.span(), inline_fluent!("link cfg is unstable"))
400-
.emit();
399+
feature_err(sess, sym::link_cfg, item.span(), msg!("link cfg is unstable")).emit();
401400
}
402401
*cfg = parse_cfg_entry(cx, link_cfg).ok();
403402
true

compiler/rustc_borrowck/src/diagnostics/mod.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ use std::collections::BTreeMap;
44

55
use rustc_abi::{FieldIdx, VariantIdx};
66
use rustc_data_structures::fx::FxIndexMap;
7-
use rustc_errors::{
8-
Applicability, Diag, DiagMessage, EmissionGuarantee, MultiSpan, inline_fluent, listify,
9-
};
7+
use rustc_errors::{Applicability, Diag, DiagMessage, EmissionGuarantee, MultiSpan, listify, msg};
108
use rustc_hir::def::{CtorKind, Namespace};
119
use rustc_hir::{
1210
self as hir, CoroutineKind, GenericBound, LangItem, WhereBoundPredicate, WherePredicateKind,
@@ -1313,7 +1311,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
13131311
let mut span: MultiSpan = spans.clone().into();
13141312
err.arg("ty", param_ty.to_string());
13151313
let msg = err.dcx.eagerly_translate_to_string(
1316-
inline_fluent!("`{$ty}` is made to be an `FnOnce` closure here"),
1314+
msg!("`{$ty}` is made to be an `FnOnce` closure here"),
13171315
err.args.iter(),
13181316
);
13191317
err.remove_arg("ty");
@@ -1322,12 +1320,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
13221320
}
13231321
span.push_span_label(
13241322
fn_call_span,
1325-
inline_fluent!("this value implements `FnOnce`, which causes it to be moved when called"),
1326-
);
1327-
err.span_note(
1328-
span,
1329-
inline_fluent!("`FnOnce` closures can only be called once"),
1323+
msg!("this value implements `FnOnce`, which causes it to be moved when called"),
13301324
);
1325+
err.span_note(span, msg!("`FnOnce` closures can only be called once"));
13311326
} else {
13321327
err.subdiagnostic(CaptureReasonNote::FnOnceMoveInCall { var_span });
13331328
}
@@ -1573,6 +1568,5 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
15731568
}
15741569
}
15751570

1576-
const LIMITATION_NOTE: DiagMessage = inline_fluent!(
1577-
"due to a current limitation of the type system, this implies a `'static` lifetime"
1578-
);
1571+
const LIMITATION_NOTE: DiagMessage =
1572+
msg!("due to a current limitation of the type system, this implies a `'static` lifetime");

compiler/rustc_borrowck/src/diagnostics/region_errors.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Error reporting machinery for lifetime errors.
22
33
use rustc_data_structures::fx::FxIndexSet;
4-
use rustc_errors::{Applicability, Diag, ErrorGuaranteed, MultiSpan, inline_fluent};
4+
use rustc_errors::{Applicability, Diag, ErrorGuaranteed, MultiSpan, msg};
55
use rustc_hir as hir;
66
use rustc_hir::GenericBound::Trait;
77
use rustc_hir::QPath::Resolved;
@@ -298,7 +298,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
298298
if suggestions.len() > 0 {
299299
suggestions.dedup();
300300
diag.multipart_suggestion_verbose(
301-
inline_fluent!("consider restricting the type parameter to the `'static` lifetime"),
301+
msg!("consider restricting the type parameter to the `'static` lifetime"),
302302
suggestions,
303303
Applicability::MaybeIncorrect,
304304
);
@@ -968,18 +968,16 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
968968
let mut multi_span: MultiSpan = vec![*span].into();
969969
multi_span.push_span_label(
970970
*span,
971-
inline_fluent!("this has an implicit `'static` lifetime requirement"),
971+
msg!("this has an implicit `'static` lifetime requirement"),
972972
);
973973
multi_span.push_span_label(
974974
ident.span,
975-
inline_fluent!(
976-
"calling this method introduces the `impl`'s `'static` requirement"
977-
),
975+
msg!("calling this method introduces the `impl`'s `'static` requirement"),
978976
);
979977
err.subdiagnostic(RequireStaticErr::UsedImpl { multi_span });
980978
err.span_suggestion_verbose(
981979
span.shrink_to_hi(),
982-
inline_fluent!("consider relaxing the implicit `'static` requirement"),
980+
msg!("consider relaxing the implicit `'static` requirement"),
983981
" + '_",
984982
Applicability::MaybeIncorrect,
985983
);
@@ -1142,7 +1140,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
11421140
if ocx.evaluate_obligations_error_on_ambiguity().is_empty() && count > 0 {
11431141
diag.span_suggestion_verbose(
11441142
tcx.hir_body(*body).value.peel_blocks().span.shrink_to_lo(),
1145-
inline_fluent!("dereference the return value"),
1143+
msg!("dereference the return value"),
11461144
"*".repeat(count),
11471145
Applicability::MachineApplicable,
11481146
);
@@ -1186,7 +1184,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
11861184
if let Some(closure_span) = closure_span {
11871185
diag.span_suggestion_verbose(
11881186
closure_span,
1189-
inline_fluent!("consider adding 'move' keyword before the nested closure"),
1187+
msg!("consider adding 'move' keyword before the nested closure"),
11901188
"move ",
11911189
Applicability::MaybeIncorrect,
11921190
);

compiler/rustc_builtin_macros/src/errors.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use rustc_errors::codes::*;
22
use rustc_errors::{
33
Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, MultiSpan, SingleLabelManySpans,
4-
Subdiagnostic, inline_fluent,
4+
Subdiagnostic, msg,
55
};
66
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
77
use rustc_span::{Ident, Span, Symbol};
@@ -752,7 +752,7 @@ pub(crate) struct FormatUnusedArg {
752752
impl Subdiagnostic for FormatUnusedArg {
753753
fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
754754
diag.arg("named", self.named);
755-
let msg = diag.eagerly_translate(inline_fluent!(
755+
let msg = diag.eagerly_translate(msg!(
756756
"{$named ->
757757
[true] named argument
758758
*[false] argument
@@ -935,13 +935,12 @@ pub(crate) struct AsmClobberNoReg {
935935
impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for AsmClobberNoReg {
936936
fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, G> {
937937
// eager translation as `span_labels` takes `AsRef<str>`
938-
let lbl1 = dcx.eagerly_translate_to_string(inline_fluent!("clobber_abi"), [].into_iter());
939-
let lbl2 =
940-
dcx.eagerly_translate_to_string(inline_fluent!("generic outputs"), [].into_iter());
938+
let lbl1 = dcx.eagerly_translate_to_string(msg!("clobber_abi"), [].into_iter());
939+
let lbl2 = dcx.eagerly_translate_to_string(msg!("generic outputs"), [].into_iter());
941940
Diag::new(
942941
dcx,
943942
level,
944-
inline_fluent!("asm with `clobber_abi` must specify explicit registers for outputs"),
943+
msg!("asm with `clobber_abi` must specify explicit registers for outputs"),
945944
)
946945
.with_span(self.spans.clone())
947946
.with_span_labels(self.clobbers, &lbl1)

compiler/rustc_codegen_llvm/src/errors.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::ffi::CString;
22
use std::path::Path;
33

44
use rustc_data_structures::small_c_str::SmallCStr;
5-
use rustc_errors::{Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, inline_fluent};
5+
use rustc_errors::{Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, msg};
66
use rustc_macros::Diagnostic;
77
use rustc_span::Span;
88

@@ -28,7 +28,7 @@ impl<G: EmissionGuarantee> Diagnostic<'_, G> for ParseTargetMachineConfig<'_> {
2828
Diag::new(
2929
dcx,
3030
level,
31-
inline_fluent!("failed to parse target machine config to target machine: {$error}"),
31+
msg!("failed to parse target machine config to target machine: {$error}"),
3232
)
3333
.with_arg("error", message)
3434
}
@@ -125,29 +125,29 @@ impl<G: EmissionGuarantee> Diagnostic<'_, G> for WithLlvmError<'_> {
125125
fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
126126
use LlvmError::*;
127127
let msg_with_llvm_err = match &self.0 {
128-
WriteOutput { .. } => inline_fluent!("could not write output to {$path}: {$llvm_err}"),
129-
CreateTargetMachine { .. } => inline_fluent!(
130-
"could not create LLVM TargetMachine for triple: {$triple}: {$llvm_err}"
131-
),
132-
RunLlvmPasses => inline_fluent!("failed to run LLVM passes: {$llvm_err}"),
128+
WriteOutput { .. } => msg!("could not write output to {$path}: {$llvm_err}"),
129+
CreateTargetMachine { .. } => {
130+
msg!("could not create LLVM TargetMachine for triple: {$triple}: {$llvm_err}")
131+
}
132+
RunLlvmPasses => msg!("failed to run LLVM passes: {$llvm_err}"),
133133
SerializeModule { .. } => {
134-
inline_fluent!("failed to serialize module {$name}: {$llvm_err}")
134+
msg!("failed to serialize module {$name}: {$llvm_err}")
135135
}
136-
WriteIr { .. } => inline_fluent!("failed to write LLVM IR to {$path}: {$llvm_err}"),
136+
WriteIr { .. } => msg!("failed to write LLVM IR to {$path}: {$llvm_err}"),
137137
PrepareThinLtoContext => {
138-
inline_fluent!("failed to prepare thin LTO context: {$llvm_err}")
138+
msg!("failed to prepare thin LTO context: {$llvm_err}")
139139
}
140140
LoadBitcode { .. } => {
141-
inline_fluent!("failed to load bitcode of module \"{$name}\": {$llvm_err}")
141+
msg!("failed to load bitcode of module \"{$name}\": {$llvm_err}")
142142
}
143143
WriteThinLtoKey { .. } => {
144-
inline_fluent!("error while writing ThinLTO key data: {$err}: {$llvm_err}")
144+
msg!("error while writing ThinLTO key data: {$err}: {$llvm_err}")
145145
}
146146
PrepareThinLtoModule => {
147-
inline_fluent!("failed to prepare thin LTO module: {$llvm_err}")
147+
msg!("failed to prepare thin LTO module: {$llvm_err}")
148148
}
149-
ParseBitcode => inline_fluent!("failed to parse bitcode for LTO module: {$llvm_err}"),
150-
PrepareAutoDiff { .. } => inline_fluent!(
149+
ParseBitcode => msg!("failed to parse bitcode for LTO module: {$llvm_err}"),
150+
PrepareAutoDiff { .. } => msg!(
151151
"failed to prepare autodiff: {$llvm_err}, src: {$src}, target: {$target}, {$error}"
152152
),
153153
};

0 commit comments

Comments
 (0)