-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Pretty printer inlines modules #12590
Comments
Triage: the output here has gotten weirder:
I'm guessing the blank line comes from dropping the comment when |
Triage: it is now un-weird, and back to the original way it was reported in the ticket. |
I personally thought that |
But the original report is about |
Oh. Yeah, that's true. I'm not even really sure what the intended purpose of |
I made a PR that fixes this behavior, turned out the parser simply forgot where module items come from, so it didn't know how to not expand modules, the fix was to track this information in the Ast. |
Track whether module declarations are inline (fixes #12590) To track whether module declarations are inline I added a field `inline: bool` to `ast::Mod`. The main use case is for pretty to know whether it should render the items associated with the module, but perhaps there are use cases for this information to not be forgotten in the AST.
Track whether module declarations are inline (fixes #12590) To track whether module declarations are inline I added a field `inline: bool` to `ast::Mod`. The main use case is for pretty to know whether it should render the items associated with the module, but perhaps there are use cases for this information to not be forgotten in the AST.
a.rs
:b.rs
:Expected output of
rustc --pretty normal a.rs
:Actual output of
rustc --pretty normal a.rs
:Note the two problems here: (a) the module is inlined, and (b) the comment in the module is lost. But by fixing the first, the second becomes irrelevant.
The text was updated successfully, but these errors were encountered: