Skip to content

Commit 837cc4f

Browse files
authored
Rollup merge of rust-lang#40048 - jimblandy:fmt-arg-types-doc, r=alexcrichton
Update std::fmt module docs for landing of rust-lang#33642. Since rust-lang#33642, it's no longer true that all references to a given format argument must use the same type. The docs don't seem to have been updated.
2 parents 26643dd + 6b8e175 commit 837cc4f

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

src/libcollections/fmt.rs

+4-21
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
//!
6363
//! A format string is required to use all of its arguments, otherwise it is a
6464
//! compile-time error. You may refer to the same argument more than once in the
65-
//! format string, although it must always be referred to with the same type.
65+
//! format string.
6666
//!
6767
//! ## Named parameters
6868
//!
@@ -89,19 +89,8 @@
8989
//!
9090
//! ## Argument types
9191
//!
92-
//! Each argument's type is dictated by the format string. It is a requirement
93-
//! that every argument is only ever referred to by one type. For example, this
94-
//! is an invalid format string:
95-
//!
96-
//! ```text
97-
//! {0:x} {0:o}
98-
//! ```
99-
//!
100-
//! This is invalid because the first argument is both referred to as a
101-
//! hexadecimal as well as an
102-
//! octal.
103-
//!
104-
//! There are various parameters which do require a particular type, however.
92+
//! Each argument's type is dictated by the format string.
93+
//! There are various parameters which require a particular type, however.
10594
//! An example is the `{:.*}` syntax, which sets the number of decimal places
10695
//! in floating-point types:
10796
//!
@@ -113,13 +102,7 @@
113102
//!
114103
//! If this syntax is used, then the number of characters to print precedes the
115104
//! actual object being formatted, and the number of characters must have the
116-
//! type `usize`. Although a `usize` can be printed with `{}`, it is invalid to
117-
//! reference an argument as such. For example this is another invalid format
118-
//! string:
119-
//!
120-
//! ```text
121-
//! {:.*} {0}
122-
//! ```
105+
//! type `usize`.
123106
//!
124107
//! ## Formatting traits
125108
//!

0 commit comments

Comments
 (0)