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

edition compatibility lints: Warning about `dyn` in a macro incorrectly #56327

Open
alexcrichton opened this Issue Nov 28, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@alexcrichton
Copy link
Member

alexcrichton commented Nov 28, 2018

This code:

#![warn(rust_2018_compatibility)]

macro_rules! foo {
    () => {
        fn _foo() {
            let _x: Box<dyn Drop>;
        }
    }
}

foo!();

when compiled yields:

warning: `dyn` is a keyword in the 2018 edition
 --> src/lib.rs:6:25
  |
6 |             let _x: Box<dyn Drop>;
  |                         ^^^ help: you can use a raw identifier to stay compatible: `r#dyn`
  |
note: lint level defined here
 --> src/lib.rs:1:9
  |
1 | #![warn(rust_2018_compatibility)]
  |         ^^^^^^^^^^^^^^^^^^^^^^^
  = note: #[warn(keyword_idents)] implied by #[warn(rust_2018_compatibility)]
  = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!
  = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>

but the warning and suggestion are incorrect!

First reported at rust-lang/cargo#6359

This also applies to macro invocations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment