Skip to content

Commit cf911ac

Browse files
authored
Rollup merge of rust-lang#110766 - m-ou-se:fmt-rt, r=jyn514
More core::fmt::rt cleanup. - Removes the `V1` suffix from the `Argument` and `Flag` types. - Moves more of the format_args lang items into the `core::fmt::rt` module. (The only remaining lang item in `core::fmt` is `Arguments` itself, which is a public type.) Part of rust-lang#99012 Follow-up to rust-lang#110616
2 parents 9a3258f + 52ff751 commit cf911ac

File tree

12 files changed

+276
-275
lines changed

12 files changed

+276
-275
lines changed

compiler/rustc_ast_lowering/src/format.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ enum ArgumentType {
186186
/// Generates:
187187
///
188188
/// ```text
189-
/// <core::fmt::ArgumentV1>::new_…(arg)
189+
/// <core::fmt::Argument>::new_…(arg)
190190
/// ```
191191
fn make_argument<'hir>(
192192
ctx: &mut LoweringContext<'_, 'hir>,
@@ -327,7 +327,7 @@ fn make_format_spec<'hir>(
327327
None => sym::Unknown,
328328
},
329329
);
330-
// This needs to match `FlagV1` in library/core/src/fmt/mod.rs.
330+
// This needs to match `Flag` in library/core/src/fmt/rt.rs.
331331
let flags: u32 = ((sign == Some(FormatSign::Plus)) as u32)
332332
| ((sign == Some(FormatSign::Minus)) as u32) << 1
333333
| (alternate as u32) << 2
@@ -438,7 +438,7 @@ fn expand_format_args<'hir>(
438438
// If the args array contains exactly all the original arguments once,
439439
// in order, we can use a simple array instead of a `match` construction.
440440
// However, if there's a yield point in any argument except the first one,
441-
// we don't do this, because an ArgumentV1 cannot be kept across yield points.
441+
// we don't do this, because an Argument cannot be kept across yield points.
442442
//
443443
// This is an optimization, speeding up compilation about 1-2% in some cases.
444444
// See https://github.com/rust-lang/rust/pull/106770#issuecomment-1380790609
@@ -449,9 +449,9 @@ fn expand_format_args<'hir>(
449449
let args = if use_simple_array {
450450
// Generate:
451451
// &[
452-
// <core::fmt::ArgumentV1>::new_display(&arg0),
453-
// <core::fmt::ArgumentV1>::new_lower_hex(&arg1),
454-
// <core::fmt::ArgumentV1>::new_debug(&arg2),
452+
// <core::fmt::Argument>::new_display(&arg0),
453+
// <core::fmt::Argument>::new_lower_hex(&arg1),
454+
// <core::fmt::Argument>::new_debug(&arg2),
455455
// …
456456
// ]
457457
let elements: Vec<_> = arguments
@@ -477,9 +477,9 @@ fn expand_format_args<'hir>(
477477
// Generate:
478478
// &match (&arg0, &arg1, &…) {
479479
// args => [
480-
// <core::fmt::ArgumentV1>::new_display(args.0),
481-
// <core::fmt::ArgumentV1>::new_lower_hex(args.1),
482-
// <core::fmt::ArgumentV1>::new_debug(args.0),
480+
// <core::fmt::Argument>::new_display(args.0),
481+
// <core::fmt::Argument>::new_lower_hex(args.1),
482+
// <core::fmt::Argument>::new_debug(args.0),
483483
// …
484484
// ]
485485
// }

compiler/rustc_const_eval/src/transform/check_consts/ops.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> {
296296
diag_trait(&mut err, self_ty, tcx.require_lang_item(LangItem::Deref, Some(span)));
297297
err
298298
}
299-
_ if tcx.opt_parent(callee) == tcx.get_diagnostic_item(sym::ArgumentV1Methods) => ccx
299+
_ if tcx.opt_parent(callee) == tcx.get_diagnostic_item(sym::ArgumentMethods) => ccx
300300
.tcx
301301
.sess
302302
.create_err(errors::NonConstFmtMacroCall { span, kind: ccx.const_kind() }),

compiler/rustc_span/src/symbol.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,7 @@ symbols! {
129129
Any,
130130
Arc,
131131
Argument,
132-
ArgumentV1,
133-
ArgumentV1Methods,
132+
ArgumentMethods,
134133
Arguments,
135134
AsMut,
136135
AsRef,

0 commit comments

Comments
 (0)