-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
pprust: Improve pretty-printing of delimited token groups #62667
Conversation
This comment has been minimized.
This comment has been minimized.
@@ -703,6 +703,7 @@ pub trait PrintState<'a>: std::ops::Deref<Target=pp::Printer> + std::ops::DerefM | |||
&mut self, | |||
path: &ast::Path, | |||
has_bang: bool, | |||
ident: Option<ast::Ident>, | |||
tts: TokenStream, | |||
delim: MacDelimiter, | |||
span: Span, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could take ast::Mac
as an argument here? It looks like that would at least somewhat cut down on the arguments to this function -- path, delim, tts, and span are all in ast::Mac
. But I'm not sure if it'd actually be an improvement :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With macro
support it's even further from ast::Mac
now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think it's probably not worth the attempt to do something yet -- definitely something for a future refactor I think.
r=me with Azure passing |
@bors r=Mark-Simulacrum |
📌 Commit 8574d0644443bfecf9b39f538a972d996a66c449 has been approved by |
☔ The latest upstream changes (presumably #62638) made this pull request unmergeable. Please resolve the merge conflicts. |
So that path and macro argument printing code can be shared
Wrap the whole attribute into a box instead
Fix some remaining cases of bad formatting Update some failing tests
@bors r=Mark-Simulacrum |
📌 Commit 0cdd18d has been approved by |
pprust: Improve pretty-printing of delimited token groups The commit "Do not convert attributes into `MetaItem`s for printing" fixes #62628. Other commits fix regressions from abandoning `MetaItem`s, and make formatting for attributes, macro calls, macro definitions and other delimited token groups better and more consistent. r? @Mark-Simulacrum
☀️ Test successful - checks-azure, checks-travis, status-appveyor |
Tested on commit rust-lang/rust@92b0f52. Direct link to PR: <rust-lang/rust#62667> 💔 rls on linux: test-pass → test-fail (cc @Xanewok, @rust-lang/infra).
The commit "Do not convert attributes into
MetaItem
s for printing" fixes #62628.Other commits fix regressions from abandoning
MetaItem
s, and make formatting for attributes, macro calls, macro definitions and other delimited token groups better and more consistent.r? @Mark-Simulacrum