Skip to content

Docs: fix incorrect copy-paste for new X? in formatting strings - #49161

Merged
bors merged 1 commit into
masterfrom
SimonSapin-patch-1
Mar 20, 2018
Merged

Docs: fix incorrect copy-paste for new X? in formatting strings#49161
bors merged 1 commit into
masterfrom
SimonSapin-patch-1

Conversation

@SimonSapin

Copy link
Copy Markdown
Contributor

No description provided.

SimonSapin referenced this pull request Mar 19, 2018
Add hexadecimal formatting of integers with fmt::Debug
This can be used for integers within a larger types which implements Debug (possibly through derive) but not fmt::UpperHex or fmt::LowerHex.
```rust
assert!(format!("{:02x?}", b"Foo\0") == "[46, 6f, 6f, 00]");
assert!(format!("{:02X?}", b"Foo\0") == "[46, 6F, 6F, 00]");
```
RFC: rust-lang/rfcs#2226
The new formatting string syntax (`x?` and `X?`) is insta-stable in this PR because I don’t know how to change a built-in proc macro’s behavior based of a feature gate. I can look into adding that, but I also strongly suspect that keeping this feature unstable for a time period would not be useful as possibly no-one would use it during that time.
This PR does not add the new (public) `fmt::Formatter` proposed in the API because:
* There was some skepticism on response to this part of the RFC
* It is not possible to implement as-is without larger changes to `fmt`, because `Formatter` at the moment has no easy way to tell apart for example `Octal` from `Binary`: it only has a function pointer for the relevant `fmt()` method.
If some integer-like type outside of `std` want to implement this behavior, another RFC will likely need to propose a different public API for `Formatter`.
@SimonSapinSimonSapin added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs-api [DEPRECATED; DO NOT USE] A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools labels Mar 19, 2018
@KodrAus

Copy link
Copy Markdown
Contributor

D'oh! The most obvious things are always the hardest to see.

@bors r+

@bors

bors commented Mar 19, 2018

Copy link
Copy Markdown
Collaborator

📌 Commit 741d7a5 has been approved by KodrAus

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 19, 2018
@varkorvarkor mentioned this pull request Mar 19, 2018
@bors

bors commented Mar 19, 2018

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 741d7a5 with merge 02e297165031c3a7eebc4eca4282cd4da810bc93...

@emilyalbini

Copy link
Copy Markdown
Member

Wut, both Travis and AppVeyor failed to clone the repository, and bors didn't update.

@bors retry rollup

@bors

bors commented Mar 19, 2018

Copy link
Copy Markdown
Collaborator

@pietroalbini: 🔑 Insufficient privileges: Not in reviewers

@alexcrichton

Copy link
Copy Markdown
Member

@bors: retry

bors is having a rough day...

@kennytmkennytm mentioned this pull request Mar 19, 2018
kennytm added a commit to kennytm/rust that referenced this pull request Mar 20, 2018
…rAus
Docs: fix incorrect copy-paste for new `X?` in formatting strings
bors added a commit that referenced this pull request Mar 20, 2018
@bors
bors merged commit 741d7a5 into masterMar 20, 2018
@alexcrichton
alexcrichton deleted the SimonSapin-patch-1 branch March 23, 2018 14:35
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsS-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-libs-api[DEPRECATED; DO NOT USE]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@SimonSapin@KodrAus@bors@emilyalbini@alexcrichton