syntex
syntex copied to clipboard
Losing non-syntex derive behind cfg_attr
Moved from https://github.com/serde-rs/serde/issues/616.
See this commit for a needed workaround: https://github.com/servo/webrender/commit/efd4e1d444e54d5c7429f14e872be5c8678ca116
With some analysis at https://github.com/servo/webrender/pull/549#discussion_r87451885 -- basically, given:
#[cfg_attr(all(unix, not(target_os = "macos")), derive(Clone, Serialize, Deserialize))]
Serialize
and Deserialize
have code generated, but the resulting code does not retain #[cfg_attr(..., derive(Clone)]
as it should. (or even just #[derive(Clone)]
, if codegen is supposed to evaluate cfgs.) But
#[cfg_attr(not(any(target_os = "macos", target_os = "windows")), derive(Clone, Serialize, Deserialize))]
works. Can be reproduced by checking out webrender from https://github.com/servo/webrender/commit/6a2f35474186c593aa204559ba4373d5dbf861fb and building on linux.