Uh oh!
There was an error while loading. Please reload this page.
Better tokentree pretty printer - #39079
Conversation
rust-highfive
commented
Jan 15, 2017
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @pnkfelix (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
There was a problem hiding this comment.
Is this allowed and is there a other way to do this?
There was a problem hiding this comment.
Is this allowed and is there a other way to do this?
What is going on here while compiling stage1? |
steveklabnik
commented
Jan 17, 2017
/cc @nrc @rust-lang/compiler |
There was a problem hiding this comment.
I'm pretty sure this comment is not what you wanted...
pnkfelix
left a comment
There was a problem hiding this comment.
I'm ... pretty sure we don't approve PR's with merge commits in them. So you probably need to clean up your revision history; it may suffice to just rebase.
pnkfelix
commented
Jan 17, 2017
Also, I'm not yet sure what this is doing, because I don't remember what the token-tree printer was, what it used to look like, whether it was good/bad, et cetera. I say this mostly as a way of saying "I'm giving feedback on relatively minor points, but you should not interpret that as giving any indication about my feelings on the PR as a whole." |
bjorn3
commented
Jan 17, 2017
It is used in error mesages when for example a proc macro outputs |
nikomatsakis
commented
Jan 17, 2017
Pre-existing, but it seems like it'd be good to have some tests of this, no? |
bjorn3
commented
Jan 17, 2017
Will add them when i rebase. |
5daf971 to
757ee29Comparebjorn3
commented
Jan 17, 2017
Messed up a bit with rebasing. will have to do the fix build cycle from before again :( |
There was a problem hiding this comment.
What should I do here to fix the tidy error? Can't put a newline because I would have another string then.
There was a problem hiding this comment.
Is this allowed and is there a other way to do this?
There was a problem hiding this comment.
I don't think this is worth using unsafe.
I would just clone the token tree (i.e. self.print_tts(&[tt.clone()])) -- it isn't a deep clone, just a copy plus an Rc ref-count update. You could also refactor print_tts to take an Iterator<Item=&TokenTree>.
bjorn3
commented
Jan 17, 2017
Build fails due to bug in this tt pretty printer. |
bjorn3
commented
Jan 19, 2017
I had a break which I meant to break out of the match not the loop 🤦. This meant skipping a great part of the thread_local macro. |
bjorn3
commented
Jan 19, 2017
Accidentally added a nul byte. |
Why do the tests fail? |
ad4eb97 to
f60ed6fComparebjorn3
commented
Jan 20, 2017
Rebased |
There was a problem hiding this comment.
Is there no way to print a single token? I guess the same is a problem above.
There was a problem hiding this comment.
Sad. I guess it's pre-existing, though.
eddyb
commented
Jan 20, 2017
I have no suggestions about the bug other than "comment out the special cases and see if that still fails". |
bjorn3
commented
Jan 22, 2017
@eddyb I can't reproduce the travis error on local mac osx. Only run-fail/assert-macro-explicit.rs fails due to a added space. |
bjorn3
commented
Jan 22, 2017
Are the location of stringify! spaces and newlines (semi)guaranteed. If so this is a breaking change. |
@bjorn3 Alright, you can still sort of abuse Travis to test it for you. I'd suggest pushing a single commit that comments out all the special cases but leaves your own code for the default cases. |
bors
commented
Jan 28, 2017
📌 Commit cc4eb99 has been approved by |
bors
commented
Jan 28, 2017
⌛ Testing commit cc4eb99 with merge ded091d... |
alexcrichton
commented
Jan 28, 2017
@bors: retry
|
bors
commented
Jan 28, 2017
⌛ Testing commit cc4eb99 with merge cbf842f... |
bors
commented
Jan 28, 2017
💔 Test failed - status-appveyor |
bjorn3
commented
Jan 29, 2017
@pnkfelix test passes. |
Squashed
|
pnkfelix
commented
Jan 30, 2017
@bors r+ |
bors
commented
Jan 30, 2017
📌 Commit 0409508 has been approved by |
bors
commented
Jan 30, 2017
⌛ Testing commit 0409508 with merge a62accf... |
bors
commented
Jan 30, 2017
💔 Test failed - status-travis |
bjorn3
commented
Jan 30, 2017
I think i will make a script to update the failing pretty print tests: |
pnkfelix
commented
Feb 1, 2017
@bjorn3 travis says tidy checks are failling. |
There was a problem hiding this comment.
Two interesting things here:
{should never start a new line before it, always after- it gets trickier sometimes thought (
}and;come to be mind) - the whole reason there's a
pp.rsis for automating breaks - but I'm not sure the algorithm is appropriate for Rust or bug-free
- it gets trickier sometimes thought (
,should never have a space before it, always after
There was a problem hiding this comment.
I dont really understand print::pp to be honest. Documentation would be really appreciated.
There was a problem hiding this comment.
Found docs at the Printer struct. Opened #39557 with a few doc improvements.
bors
commented
Mar 1, 2017
☔ The latest upstream changes (presumably #39419) made this pull request unmergeable. Please resolve the merge conflicts. |
pnkfelix
commented
Mar 20, 2017
@bjorn3 are you going to be able to address the problems on this PR? (From what I can tell, Travis was never satisfied with it...?) Or should I close it to clean up the queue? |
bjorn3
commented
Mar 20, 2017
If I want to retry this in the future I will make a new pr. |
The example at the homepage now print like this when parsed as tokentrees: