Closed
Description
Originally reported as rust-lang/rustfix#126 this is reduced to:
// foo.rs
#![crate_type = "proc-macro"]
extern crate proc_macro;
use proc_macro::TokenStream;
#[proc_macro_derive(Foo)]
pub fn foo(a: TokenStream) -> TokenStream {
"".parse().unwrap()
}
#[proc_macro_derive(Bar, attributes(custom))]
pub fn bar(a: TokenStream) -> TokenStream {
"".parse().unwrap()
}
// bar.rs
#![cfg_attr(broken, feature(proc_macro))]
#![crate_type = "lib"]
#[macro_use]
extern crate foo;
#[derive(Foo, Bar, Debug)]
#[custom = "test"]
pub enum A{
B,
C,
}
compiles with:
$ rustc +nightly foo.rs
$ rustc +nightly bar.rs -L .
$ rustc +nightly bar.rs -L . --cfg broken
error: cannot find attribute macro `custom` in this scope
--> bar.rs:8:3
|
8 | #[custom = "test"]
| ^^^^^^
error: aborting due to previous error