Open dtolnay opened 8 years ago
The workaround is:
#[cfg(condition)]
#[cfg_attr(condition, derive(Trait))]
#[other_attributes]
struct Struct;
which will work on Syntex >=0.36 and rustc >=1.11.
A different workaround that works on older Syntex and older rustc:
#[cfg(condition)]
mod workaround {
#[derive(Trait)]
#[other_attributes]
pub struct Struct;
}
#[cfg(condition)]
use self::workaround::Struct;
This will no longer be necessary with Macros 1.1.
Currently Syntex expands this:
... into this:
It would be better to expand to this:
Open question whether we want to copy other attributes as well.