Skip to content
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

Merged
merged 1 commit into from
Nov 26, 2014

Conversation

steveklabnik
Copy link
Member

Fixes #19209

@@ -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
Copy link
Member

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

Copy link
Member Author

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?

Copy link
Member

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 :(.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, will do now.

@steveklabnik
Copy link
Member Author

@alexcrichton r?

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:
Copy link
Member

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}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@steveklabnik steveklabnik force-pushed the doc_format_specifiers branch 2 times, most recently from 671f2ec to c5f06a2 Compare November 24, 2014 17:37
@steveklabnik
Copy link
Member Author

@alexcrichton how about now?

@alexcrichton
Copy link
Member

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;

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean?

bors added a commit that referenced this pull request Nov 26, 2014
@bors bors closed this Nov 26, 2014
@bors bors merged commit 7dadb14 into rust-lang:master Nov 26, 2014
@steveklabnik steveklabnik deleted the doc_format_specifiers branch October 25, 2017 18:27
lnicola added a commit to lnicola/rust that referenced this pull request Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

std::fmt docs still reference old specifiers
4 participants