-
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
Implement #fmt extension in rustc. #175
Comments
I wrote one as a syntax extension a couple weeks ago. It's called #fmt, and is typesafe. It's implemented in boot/fe/extfmt.ml. (Incomplete mind you; I think I left it at the point of only knowing how to do %d, %u, %s, %c and %x. The easy bits. Feel free to extend.) |
Shifting to rustc to track the #fmt extension. |
This is partially implemented now, waiting on vector append and crate access. |
I'm taking a bit of a break from this, so here's a brain dump of where #fmt stands. This is implemented now for bool (b), string (s), char (c), int (i, d), uint (u), unsigned hex (x, X), unsigned binary (t), and unsigned octal (o) types, with explicit width and precision, and the left justify (-), zero pad (0), sign (+), leave space for sign (' ') flags, all according to printf rules. Things it doesn't implement yet:
Things that it should probably do:
Implementation deficiencies:
|
At long last, this patch makes #fmt usable from inside the standard library. The way it does it us very hackish, but at least it works now.
Should this be closed? |
No. Not complete. |
I suppose it could be split out into the remaining tasks. |
See also #1014 |
Does this relate to #246? |
Yes. #246 implemented most of #fmt, but the majority of the features I mentioned in my previous comment in May are still not implemented. |
#fmt's deficiencies have slowly been chipped away. I filed new issues for the remaining problems. Closing. |
remove unneeded '-gnu' suffix from compiletest ignore directives
Merging 2 PRs together
Say what traits that function items impl by default.
Delete travis config, move tests to github actions.
Make symbol and section names optional, for when llvm returns a nullptr.
Also remove unused imports.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.
Talking to pcwalton here at a Rust hack session and he mentioned that it'd be really great to have a
printf()
implementation.At first the implementation could be non-typesafe, but once compiler plugins are implemented, we can actually make one that statically type-checks at compile time.
The text was updated successfully, but these errors were encountered: