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

Adding skip to macro definition causes import resolution and absolute path errors on import #4449

Closed
Txuritan opened this issue Oct 2, 2020 · 3 comments
Labels
bug Panic, non-idempotency, invalid code, etc.

Comments

@Txuritan
Copy link

Txuritan commented Oct 2, 2020

Describe the bug

Adding #[rustfmt:skip] to a macro definition causes rustc errors when trying to import it.

error: cannot determine resolution for the import
  --> src/main.rs:10:9
   |
10 |     use crate::o;
   |         ^^^^^^^^
   |
   = note: import resolution is stuck, try simplifying other imports

error: macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths
  --> src/main.rs:10:9
   |
10 |     use crate::o;
   |         ^^^^^^^^
   |
   = note: `#[deny(macro_expanded_macro_exports_accessed_by_absolute_paths)]` on by default
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #52234 <https://github.com/rust-lang/rust/issues/52234>
note: the macro is defined here
  --> src/main.rs:4:5
   |
4  | /     macro_rules! o {
5  | |         () => {};
6  | |     }
   | |_____^

error: aborting due to 2 previous errors

To Reproduce

Have two modules, in one add a macro definition with #[rustfmt:skip], and in the other import the macro. The module with import will fail to compile

Heres a playground link used to create the log above.

Meta

  • rustfmt version: rustfmt 1.4.18-stable (8157a3f 2020-07-15)
  • From where did you install rustfmt?: rustup
  • How do you run rustfmt: rustfmt
@Txuritan Txuritan added the bug Panic, non-idempotency, invalid code, etc. label Oct 2, 2020
@calebcartwright
Copy link
Member

Thanks for reaching out @Txuritan, but rustc-related issues need to be reported in the main rust-lang/rust repo (note that this can be reproduced with other, non rustfmt tool attributes like #[clippy::cyclomatic_complexity = "100"]).

Sounds very similar to rust-lang/rust#74087

Closing this accordingly

@Txuritan
Copy link
Author

Txuritan commented Oct 2, 2020

Nevertheless, thank you for pointing that issue out, I never found it when I was trying to figure out what was causing this.

@calebcartwright
Copy link
Member

Sure thing! I thought it sounded familiar 😄

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.
Projects
None yet
Development

No branches or pull requests

2 participants