Skip to content

Proc macro gives bad error about custom derives if regular macro with the same name is imported first #39326

Description

@Arnavion

rustc 1.16.0-nightly (7821a9b 2017-01-23)

main.rs

#[macro_use] extern crate derive_error_chain;
#[macro_use] extern crate error_chain;

#[derive(Debug, error_chain)]
pub enum ErrorKind {
    Msg(String),
}

fn main() {
}

Cargo.toml

[package]
name = "rust-test"
version = "0.1.0"
authors = ["Arnavion <arnavion@gmail.com>"]

[dependencies]
derive-error-chain = "=0.8.0"
error-chain = "=0.8.1"

cargo build gives:

error: `#[derive]` for custom traits is not stable enough for use. It is deprecated and will be removed in v1.15 (see issue #29644)
 --> src\main.rs:4:17
  |
4 | #[derive(Debug, error_chain)]
  |                 ^^^^^^^^^^^
  |
  = help: add #![feature(custom_derive)] to the crate attributes to enable

error: aborting due to previous error

derive-error-chain exports a proc macro named error_chain. error-chain exports a regular macro named error_chain.

Everything's fine if the order of the extern crate statements is reversed, or error-chain's import does not have #[macro_use].

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions