Skip to content

Commit a33907a

Browse files
committed
Auto merge of #152627 - JonathanBrouwer:rollup-wjHXhK0, r=JonathanBrouwer
Rollup of 8 pull requests Successful merges: - #152618 (stdarch subtree update) - #152001 (mGCA: Validate const literal against expected type) - #152120 (Don't ICE on layout error in vtable computation) - #152531 (`proc_macro::bridge`: simplify `ExecutionStrategy` and `DispatcherTrait`) - #152577 (Port #[rustc_proc_macro_decls] to the new attribute parser.) - #152570 (Port #[rustc_test_marker] to the attribute parser) - #152590 (DepGraphQuery: correctly skip adding edges with not-yet-added nodes) - #152612 (Rename `inline_fluent!` to `msg!`)
2 parents f846389 + 38cc50b commit a33907a

128 files changed

Lines changed: 1659 additions & 1779 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/attributes/test_attrs.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,3 +257,36 @@ impl<S: Stage> SingleAttributeParser<S> for TestRunnerParser {
257257
Some(AttributeKind::TestRunner(meta.path().0.clone()))
258258
}
259259
}
260+
261+
pub(crate) struct RustcTestMarkerParser;
262+
263+
impl<S: Stage> SingleAttributeParser<S> for RustcTestMarkerParser {
264+
const PATH: &[Symbol] = &[sym::rustc_test_marker];
265+
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost;
266+
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
267+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
268+
Allow(Target::Const),
269+
Allow(Target::Fn),
270+
Allow(Target::Static),
271+
]);
272+
const TEMPLATE: AttributeTemplate = template!(NameValueStr: "test_path");
273+
274+
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<AttributeKind> {
275+
let Some(name_value) = args.name_value() else {
276+
cx.expected_name_value(cx.attr_span, Some(sym::rustc_test_marker));
277+
return None;
278+
};
279+
280+
let Some(value_str) = name_value.value_as_str() else {
281+
cx.expected_string_literal(name_value.value_span, None);
282+
return None;
283+
};
284+
285+
if value_str.as_str().trim().is_empty() {
286+
cx.expected_non_empty_string_literal(name_value.value_span);
287+
return None;
288+
}
289+
290+
Some(AttributeKind::RustcTestMarker(value_str))
291+
}
292+
}

compiler/rustc_attr_parsing/src/context.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ attribute_parsers!(
217217
Single<RustcScalableVectorParser>,
218218
Single<RustcSimdMonomorphizeLaneLimitParser>,
219219
Single<RustcSymbolName>,
220+
Single<RustcTestMarkerParser>,
220221
Single<SanitizeParser>,
221222
Single<ShouldPanicParser>,
222223
Single<SkipDuringMethodDispatchParser>,
@@ -300,6 +301,7 @@ attribute_parsers!(
300301
Single<WithoutArgs<RustcOutlivesParser>>,
301302
Single<WithoutArgs<RustcPassIndirectlyInNonRusticAbisParser>>,
302303
Single<WithoutArgs<RustcPreserveUbChecksParser>>,
304+
Single<WithoutArgs<RustcProcMacroDeclsParser>>,
303305
Single<WithoutArgs<RustcReallocatorParser>>,
304306
Single<WithoutArgs<RustcRegionsParser>>,
305307
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
);

0 commit comments

Comments
 (0)