Skip to content

Add %p modifier to fmt! #8011

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

Closed
jdm opened this issue Jul 23, 2013 · 5 comments
Closed

Add %p modifier to fmt! #8011

jdm opened this issue Jul 23, 2013 · 5 comments
Labels
A-syntaxext Area: Syntax extensions E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@jdm
Copy link
Contributor

jdm commented Jul 23, 2013

I grow tired of printing out unsafe pointer values with fmt!("0x%x", somePointer as uint). It would be nice to use fmt!("%p", somePointer) instead.

@minhnhdo
Copy link
Contributor

Hi, I'd love to work on this one. I have found the files which contain the code pertaining to the issue (src/libstd/unstable/extfmt.rs, src/libsyntax/ext/fmt.rs). Could you tell me where the format string is parsed and where the types of the arguments are determined?

@jdm
Copy link
Contributor Author

jdm commented Jul 27, 2013

Judging by the let pieces = parse_fmt_string(fmt, parse_fmt_err); in fmt.rs, it looks like you probably want to add a TyPointer to parse_type (https://github.com/mozilla/rust/blob/master/src/libstd/unstable/extfmt.rs#L311) and then you can probably cargo-cult the way that TyHex is used.

@minhnhdo
Copy link
Contributor

@jdm could you please tell me what the exclamation mark in the following declaration means?
type ErrorFn = @fn(&str) -> !;

@jdm
Copy link
Contributor Author

jdm commented Jul 27, 2013

@minhnhdo
Copy link
Contributor

@jdm since the code is merged into the main branch, could you close this issue?

flip1995 pushed a commit to flip1995/rust that referenced this issue Nov 23, 2021
Avoid inline hints with double backticks for `doc-markdown`

The easiest route here was to ensure that the suggestion is always shown on
its own line, where no additional backticks are added by the diagnostic formatter.

Fixes rust-lang#8002

---

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: Avoid inline hints with double backticks for `doc-markdown`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-syntaxext Area: Syntax extensions E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

3 participants