-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove deprecated stuff from std::fmt docs #19212
Conversation
@@ -104,63 +104,15 @@ It is illegal to put positional parameters (those without names) after arguments | |||
which have names. Like with positional parameters, it is illegal to provide | |||
named parameters that are unused by the format string. | |||
|
|||
### Argument types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that #19209 was just referring to the :d
and :u
modifiers, you can still specify different types for arguments so we may not want to delete the documentation wholesale
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was reading that, but the whole section basically relies on :d
, so I just chucked it. Which modifiers do we actually have now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you re-word it with respect to :x
or :o
(hex or octal). The list of format specifiers below is accurate for today's state, I just forgot to update the other text :(.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, will do now.
988498b
to
9c7190d
Compare
There are various parameters which do require a particular type, however. Namely if the syntax | ||
`{:.*s}` is used, then the number of characters to print from the string precedes the actual string | ||
and must have the type `uint`. Although a `uint` can be printed with `{:u}`, it is illegal to | ||
reference an argument as such. For example, this is another invalid format string: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These still reference :s
and :u
, perhaps something like:
There are various parameters which do require a particular type, however. Namely if the syntax {:.*}
is used, then the number of characters to print precedes the actual object being formatted, and the number of characters must have the type uint
. Although a uint
can be printed with {}
, it is illegal to reference an argument as such. For example this is another invalid format string:
{:.*} {0}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
671f2ec
to
c5f06a2
Compare
@alexcrichton how about now? |
Thanks @steveklabnik! |
# trait SomeName<T> { | ||
# use std::fmt; | ||
# struct Foo; // our custom type | ||
# impl fmt::Show for Foo { | ||
fn fmt(&self, f: &mut std::fmt::Formatter) -> fmt::Result; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That isn't going to pass, it's not an implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean?
c5f06a2
to
7dadb14
Compare
minor: sync from downstream
Fixes #19209