Skip to content

Commit b184b22

Browse files
committed
Auto merge of #152616 - JonathanBrouwer:rollup-BArj5rR, r=JonathanBrouwer
Rollup of 7 pull requests Successful merges: - #152001 (mGCA: Validate const literal against expected type) - #152120 (Don't ICE on layout error in vtable computation) - #152512 (core: Implement feature `float_exact_integer_constants`) - #152531 (`proc_macro::bridge`: simplify `ExecutionStrategy` and `DispatcherTrait`) - #152577 (Port #[rustc_proc_macro_decls] to the new attribute parser.) - #152590 (DepGraphQuery: correctly skip adding edges with not-yet-added nodes) - #152612 (Rename `inline_fluent!` to `msg!`)
2 parents f846389 + 0461a01 commit b184b22

128 files changed

Lines changed: 1618 additions & 1202 deletions

File tree

Some content is hidden

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

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/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_attr_parsing/src/attributes/macro_attrs.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,3 +206,12 @@ impl<S: Stage> SingleAttributeParser<S> for CollapseDebugInfoParser {
206206
Some(AttributeKind::CollapseDebugInfo(info))
207207
}
208208
}
209+
210+
pub(crate) struct RustcProcMacroDeclsParser;
211+
212+
impl<S: Stage> NoArgsAttributeParser<S> for RustcProcMacroDeclsParser {
213+
const PATH: &[Symbol] = &[sym::rustc_proc_macro_decls];
214+
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
215+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Static)]);
216+
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcProcMacroDecls;
217+
}

compiler/rustc_attr_parsing/src/context.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ attribute_parsers!(
300300
Single<WithoutArgs<RustcOutlivesParser>>,
301301
Single<WithoutArgs<RustcPassIndirectlyInNonRusticAbisParser>>,
302302
Single<WithoutArgs<RustcPreserveUbChecksParser>>,
303+
Single<WithoutArgs<RustcProcMacroDeclsParser>>,
303304
Single<WithoutArgs<RustcReallocatorParser>>,
304305
Single<WithoutArgs<RustcRegionsParser>>,
305306
Single<WithoutArgs<RustcShouldNotBeCalledOnConstItems>>,

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;
@@ -291,7 +291,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
291291
if suggestions.len() > 0 {
292292
suggestions.dedup();
293293
diag.multipart_suggestion_verbose(
294-
inline_fluent!("consider restricting the type parameter to the `'static` lifetime"),
294+
msg!("consider restricting the type parameter to the `'static` lifetime"),
295295
suggestions,
296296
Applicability::MaybeIncorrect,
297297
);
@@ -982,18 +982,16 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
982982
let mut multi_span: MultiSpan = vec![*span].into();
983983
multi_span.push_span_label(
984984
*span,
985-
inline_fluent!("this has an implicit `'static` lifetime requirement"),
985+
msg!("this has an implicit `'static` lifetime requirement"),
986986
);
987987
multi_span.push_span_label(
988988
ident.span,
989-
inline_fluent!(
990-
"calling this method introduces the `impl`'s `'static` requirement"
991-
),
989+
msg!("calling this method introduces the `impl`'s `'static` requirement"),
992990
);
993991
err.subdiagnostic(RequireStaticErr::UsedImpl { multi_span });
994992
err.span_suggestion_verbose(
995993
span.shrink_to_hi(),
996-
inline_fluent!("consider relaxing the implicit `'static` requirement"),
994+
msg!("consider relaxing the implicit `'static` requirement"),
997995
" + '_",
998996
Applicability::MaybeIncorrect,
999997
);
@@ -1156,7 +1154,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
11561154
if ocx.evaluate_obligations_error_on_ambiguity().is_empty() && count > 0 {
11571155
diag.span_suggestion_verbose(
11581156
tcx.hir_body(*body).value.peel_blocks().span.shrink_to_lo(),
1159-
inline_fluent!("dereference the return value"),
1157+
msg!("dereference the return value"),
11601158
"*".repeat(count),
11611159
Applicability::MachineApplicable,
11621160
);
@@ -1200,7 +1198,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
12001198
if let Some(closure_span) = closure_span {
12011199
diag.span_suggestion_verbose(
12021200
closure_span,
1203-
inline_fluent!("consider adding 'move' keyword before the nested closure"),
1201+
msg!("consider adding 'move' keyword before the nested closure"),
12041202
"move ",
12051203
Applicability::MaybeIncorrect,
12061204
);

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};
@@ -764,7 +764,7 @@ pub(crate) struct FormatUnusedArg {
764764
impl Subdiagnostic for FormatUnusedArg {
765765
fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
766766
diag.arg("named", self.named);
767-
let msg = diag.eagerly_translate(inline_fluent!(
767+
let msg = diag.eagerly_translate(msg!(
768768
"{$named ->
769769
[true] named argument
770770
*[false] argument
@@ -947,13 +947,12 @@ pub(crate) struct AsmClobberNoReg {
947947
impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for AsmClobberNoReg {
948948
fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, G> {
949949
// eager translation as `span_labels` takes `AsRef<str>`
950-
let lbl1 = dcx.eagerly_translate_to_string(inline_fluent!("clobber_abi"), [].into_iter());
951-
let lbl2 =
952-
dcx.eagerly_translate_to_string(inline_fluent!("generic outputs"), [].into_iter());
950+
let lbl1 = dcx.eagerly_translate_to_string(msg!("clobber_abi"), [].into_iter());
951+
let lbl2 = dcx.eagerly_translate_to_string(msg!("generic outputs"), [].into_iter());
953952
Diag::new(
954953
dcx,
955954
level,
956-
inline_fluent!("asm with `clobber_abi` must specify explicit registers for outputs"),
955+
msg!("asm with `clobber_abi` must specify explicit registers for outputs"),
957956
)
958957
.with_span(self.spans.clone())
959958
.with_span_labels(self.clobbers, &lbl1)

0 commit comments

Comments
 (0)