Skip to content
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

use normalization can break self imports #3568

Closed
jrobsonchase opened this issue May 19, 2019 · 1 comment · Fixed by #3570
Closed

use normalization can break self imports #3568

jrobsonchase opened this issue May 19, 2019 · 1 comment · Fixed by #3570
Labels
bug Panic, non-idempotency, invalid code, etc. p-high

Comments

@jrobsonchase
Copy link
Contributor

There are rare cases where normalizing a use a::b::{self}; into use a::b; will break things. Specifically, cases in which b already exists as a function or macro in the current namespace, and you only want to import it as a module.

Playground example: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=12f1d13256258ac8b34d06b9592a86ef

Running rustfmt on this will cause it to no longer compile.

@topecongiro topecongiro added bug Panic, non-idempotency, invalid code, etc. p-high labels May 20, 2019
@topecongiro
Copy link
Contributor

Thank you for pointing it out. Since one of rustfmt requirements is to not break the code, we need to disable this normalization. We could add a configuration option for this, but I am not sure if it would be all that useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Panic, non-idempotency, invalid code, etc. p-high
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants