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

#[rustfmt::skip] requires proc_macro_path_invoc on nightly #2815

Closed
gnzlbg opened this issue Jun 28, 2018 · 8 comments
Closed

#[rustfmt::skip] requires proc_macro_path_invoc on nightly #2815

gnzlbg opened this issue Jun 28, 2018 · 8 comments

Comments

@gnzlbg
Copy link
Contributor

gnzlbg commented Jun 28, 2018

My crate uses rust_2018_preview (don't know how relevant this is).

Using tool_attributes I get an error:

error[E0658]: paths of length greater than one in macro invocations are currently unstable (see issue #38356)
  --> src/sealed.rs:28:3
   |
28 | #[rustfmt::skip]
   |   ^^^^^^^^^^^^^
   |
   = help: add #![feature(proc_macro_path_invoc)] to the crate attributes to enable

And if I enable proc_macro_path_invoc I get:

error[E0433]: failed to resolve. Use of undeclared type or module `rustfmt`
  --> src/sealed.rs:28:3
   |
28 | #[rustfmt::skip]
   |   ^^^^^^^ Use of undeclared type or module `rustfmt`
@gnzlbg
Copy link
Contributor Author

gnzlbg commented Jun 28, 2018

MWE, the following code works unless I uncomment the 2018 preview feature (playground):

// #![feature(rust_2018_preview)]  // Uncomment for ERRORs
#![feature(tool_attributes)]
#![allow(dead_code)]

#[rustfmt::skip]
fn foo(){}
fn main() {}

@gnzlbg
Copy link
Contributor Author

gnzlbg commented Jun 28, 2018

cc @nrc

@gnzlbg
Copy link
Contributor Author

gnzlbg commented Jun 28, 2018

Workaround: replace #[rustfmt::skip] with #[cfg_attr(rustfmt, rustfmt_skip)]

@topecongiro
Copy link
Contributor

I think this is an issue due to libsyntax, not rustfmt, as the MWE above does not even compile when the first line is uncommented.

@nrc
Copy link
Member

nrc commented Jun 28, 2018

This is a bug in rustc, I'll follow-up tomorrow

@gnzlbg
Copy link
Contributor Author

gnzlbg commented Jun 28, 2018

Let me know if I should open a bug in rustc or you want to take it from here.

@nrc
Copy link
Member

nrc commented Jun 30, 2018

Reported in rust-lang/rust#51940

@nrc nrc closed this as completed Jun 30, 2018
@nrc
Copy link
Member

nrc commented Jul 11, 2018

Should be fixed in rustc now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants