Skip to content

2018 compatibility lint fires on definition of custom derive #52214

Closed
@alexcrichton

Description

@alexcrichton

Originally reported as rust-lang/rustfix#121 it's reduced to:

#![crate_type = "proc-macro"]
#![warn(rust_2018_compatibility)]
#![feature(rust_2018_preview)]

extern crate proc_macro;

use proc_macro::TokenStream;

#[proc_macro_derive(Template, attributes(template))]
pub fn derive_template(input: TokenStream) -> TokenStream {
    input
}

which generates:

warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
  --> src/lib.rs:10:1
   |
10 | / pub fn derive_template(input: TokenStream) -> TokenStream {
11 | |     input
12 | | }
   | |_^
   |
note: lint level defined here
  --> src/lib.rs:2:9
   |
2  | #![warn(rust_2018_compatibility)]
   |         ^^^^^^^^^^^^^^^^^^^^^^^
   = note: #[warn(absolute_paths_not_starting_with_crate)] 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 TBD
help: use `crate`
   |
10 | crate::pub fn derive_template(input: TokenStream) -> TokenStream {
11 |     input
12 | }
   |

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-edition-2018Area: The 2018 editionA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions