Rust: tool_attributes feature stops working when rust_2018_preview feature is enabled

Created on 1 Jun 2018  路  8Comments  路  Source: rust-lang/rust

If both features tool_attributes and rust_2018_preview are enabled, scoped attributes lead to the error message

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

I think this can be fixed by doing this https://github.com/rust-lang/rust/pull/47773#pullrequestreview-92758596 right. I would like to try and fix this, but I need some pointers where to start.

This needs to be fixed, so clippy can use the new scoped attributes instead of the old cfg_attrs (https://github.com/rust-lang-nursery/rust-clippy/pull/2823).

I tried this code:

#![feature(tool_attributes)]
#![feature(rust_2018_preview)]

#[rustfmt::skip]
fn main() {
    //code not to format
}

Playground
This should compile without errors, but gives the error above

Meta

rustc 1.28.0-nightly (5d0631a64 2018-05-30)
binary: rustc
commit-hash: 5d0631a6438cf30cac236b7176371663e35c8d07
commit-date: 2018-05-30
host: x86_64-unknown-linux-gnu
release: 1.28.0-nightly
LLVM version: 6.0

Most helpful comment

@nrc
Yes, this weekend.
This is at the top of my work queue right now.

All 8 comments

cc @petrochenkov

For what it's worth tool attributes work within the crate so one can use #[clippy::whatever] but external attributes like #[rustfmt::skip] trigger the error.

I would like to try and fix this, but I need some pointers where to start.

@petrochenkov are you able to provide some mentoring instructions here please?

ping @petrochenkov are you likely to be able to look at this or provide mentoring instructions? Sorry, I know you have a lot on your plate right now, but this is a blocker bug for Rustfmt

@nrc
Yes, this weekend.
This is at the top of my work queue right now.

Thanks @petrochenkov !

I wasn't able to finish this during the weekend, but it's still mostly done, I'll open a PR soon.

Was this page helpful?
0 / 5 - 0 ratings