-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Add initial support for a new formatting syntax #8182
Conversation
The new macro is available under the name ifmt! (only an intermediate name)
Having a separate pass for fmt trait gathering seems a little ad-hoc. The Lispy way to do this would be to have the syntax extension itself do this. |
Same with the special section in the metadata. I wonder if we could have a generic way for syntax extensions to register serializable and deserializable data. |
Yeah I agree that this would be a lot better with a true syntax extension. Right now our current system of syntax extensions doesn't quite support this because it needs access to all of the crates, sadly. This is probably more of an indication that the syntax extension system should be more flexible than anything else. |
Yeah, I"m having a hard time with the quantity of machinery here too. Especially the new metadata and expression parts. Is this all because you're trying to support user-extensible formating operator names (eg. |
+1 to keeping fmt! a pure syntax extension. |
+1 to Graydon's comment about manually curating the list for now. |
Sure thing, we'll lose the idea that you can create your own formatting traits, but all in all I think you guys are right that it added a bit too much stuff to the compiler. I'll reopen when I've removed all of that infrastructure. |
This is a reopening of #8182, although this removes any abuse of the compiler internals. Now it's just a pure syntax extension (hard coded what the attribute names are).
cache test item names This avoids quadratic behavior (collecting all test item names for each `eq_op` instance within the module). However, it invests a good deal of memory to buy this speedup. If that becomes a problem, I may need to change the cache to only store the chain of last visited modules. This hopefully fixes rust-lang#8171. --- changelog: none
This pull request is the initial framework necessary for the advent of a new
string formatting system which will eventually replace
fmt!
. There's certainlya lot of stuff going on here, so here's a bit of a summary:
This entire implementation is based off of the discussions had on the mailing
lists at:
It should be noted that this is not ready to actually replace the
fmt!
macro.This request simply lays all of the groundwork to implement this new system.
The largest missing component is that all formatting specifiers are ignored.
Additionally, I'd like to take some time to bikeshed the format modifier syntax
after researching it a bit more.
Some notable points of the implementation
unsafe
Testing wise, I've included
Note that all of the code links will become stale as I rebase, but I don't
think that anything major will be changing at this point. The best examples can
be found in the run-pass test, although there's probably a number of cases that
I've missed!
I also realize that this is very large, although I couldn't figure out a really
good way of splitting it up. If there are suggestions of how to make this a bit
more manageable, than I'd definitely take the time to split things up.