syntex icon indicating copy to clipboard operation
syntex copied to clipboard

Losing non-syntex derive behind cfg_attr

Open dtolnay opened this issue 8 years ago • 0 comments

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.

dtolnay avatar Jan 07 '17 21:01 dtolnay