Skip to content

Commit 148d3ff

Browse files
committed
Turn format arguments types into lang items.
1 parent 72dd648 commit 148d3ff

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

core/src/fmt/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ extern "C" {
262262
/// family of functions. It contains a function to format the given value. At
263263
/// compile time it is ensured that the function and the value have the correct
264264
/// types, and then this struct is used to canonicalize arguments to one type.
265+
#[cfg_attr(not(bootstrap), lang = "format_argument")]
265266
#[derive(Copy, Clone)]
266267
#[allow(missing_debug_implementations)]
267268
#[unstable(feature = "fmt_internals", reason = "internal to format_args!", issue = "none")]
@@ -274,6 +275,7 @@ pub struct ArgumentV1<'a> {
274275
/// This struct represents the unsafety of constructing an `Arguments`.
275276
/// It exists, rather than an unsafe function, in order to simplify the expansion
276277
/// of `format_args!(..)` and reduce the scope of the `unsafe` block.
278+
#[cfg_attr(not(bootstrap), lang = "format_unsafe_arg")]
277279
#[allow(missing_debug_implementations)]
278280
#[doc(hidden)]
279281
#[unstable(feature = "fmt_internals", reason = "internal to format_args!", issue = "none")]
@@ -468,8 +470,8 @@ impl<'a> Arguments<'a> {
468470
/// ```
469471
///
470472
/// [`format()`]: ../../std/fmt/fn.format.html
473+
#[cfg_attr(not(bootstrap), lang = "format_arguments")]
471474
#[stable(feature = "rust1", since = "1.0.0")]
472-
#[cfg_attr(not(test), rustc_diagnostic_item = "Arguments")]
473475
#[derive(Copy, Clone)]
474476
pub struct Arguments<'a> {
475477
// Format string pieces to print.

core/src/fmt/rt/v1.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
//! these can be statically allocated and are slightly optimized for the runtime
66
#![allow(missing_debug_implementations)]
77

8+
#[cfg_attr(not(bootstrap), lang = "format_placeholder")]
89
#[derive(Copy, Clone)]
10+
// FIXME: Rename this to Placeholder
911
pub struct Argument {
1012
pub position: usize,
1113
pub format: FormatSpec,
@@ -21,6 +23,7 @@ pub struct FormatSpec {
2123
}
2224

2325
/// Possible alignments that can be requested as part of a formatting directive.
26+
#[cfg_attr(not(bootstrap), lang = "format_alignment")]
2427
#[derive(Copy, Clone, PartialEq, Eq)]
2528
pub enum Alignment {
2629
/// Indication that contents should be left-aligned.
@@ -34,6 +37,7 @@ pub enum Alignment {
3437
}
3538

3639
/// Used by [width](https://doc.rust-lang.org/std/fmt/#width) and [precision](https://doc.rust-lang.org/std/fmt/#precision) specifiers.
40+
#[cfg_attr(not(bootstrap), lang = "format_count")]
3741
#[derive(Copy, Clone)]
3842
pub enum Count {
3943
/// Specified with a literal number, stores the value

0 commit comments

Comments
 (0)