Closed
Description
rustc 1.30.0-nightly (f8d34596f 2018-08-30)
binary: rustc
commit-hash: f8d34596ff74da91e0877212a9979cb9ca13eb7e
commit-date: 2018-08-30
host: x86_64-pc-windows-msvc
release: 1.30.0-nightly
LLVM version: 7.0
On nightly, building https://github.com/Arnavion/derive-error-chain/tree/v0.11.1/derive-error-chain-tests fails with:
error: macro `error_chain` may not be used in attributes
--> src\main.rs:49:2
|
49 | #[error_chain(error = "Error", result_ext = "ResultExt", result = "Result")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
derive-error-chain
is a custom derive that registers an attribute named error_chain
#[proc_macro_derive(ErrorChain, attributes(error_chain))]
If the crate that uses the custom derive also has the regular macro_rules
macro named error_chain
from the error-chain
crate in scope, it fails with that error.
#[macro_use]
extern crate derive_error_chain;
#[macro_use]
extern crate error_chain; // Brings `error_chain!` into scope
#[derive(Debug, ErrorChain)]
#[error_chain(error = "Error", result_ext = "ResultExt", result = "Result")] // Uses the attribute registered by the custom derive.
pub enum ErrorKind {
Msg(String),
}
Stable 1.28 does not have this problem.
I mentioned this in #38356 (comment) and #38356 (comment). @alexcrichton responded to the second one that it would not be an acceptable regression. Since it fails now without needing to enable any features, I assume this is will regress stable eventually, hence I'm opening this issue.