Skip to content

Reorders imports of modules containing #![macro_use] #4959

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

Open
nagisa opened this issue Aug 18, 2021 · 1 comment · May be fixed by #5275
Open

Reorders imports of modules containing #![macro_use] #4959

nagisa opened this issue Aug 18, 2021 · 1 comment · May be fixed by #5275
Labels
a-mods Module resolution.

Comments

@nagisa
Copy link
Member

nagisa commented Aug 18, 2021

Similar to #2399, rustfmt will still reorder mod statements of modules that contain a #![macro_use] attribute, as opposed to the mod itself being annotated with #[macro_use]. This is equivalently invalid reordering.

rustfmt 1.4.36-nightly

@calebcartwright
Copy link
Member

Our hands are somewhat tied as rustfmt works exclusively pre-expansion and the inner attributes on the mods aren't actually included in the attribute list on the corresponding items.

We do still peek inside the out-of-line mods during our up front mod-to-file resolution process so I wonder if we could somehow extend that existing mapping to be able to capture and tie back any inner attributes to the corresponding item.

@ytmimi ytmimi added the a-mods Module resolution. label Mar 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-mods Module resolution.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants