style: When deriving something with an output type, map preconditions as well.

Otherwise, deriving ToComputedValue and ToAnimatedValue in structs or enums with
other where clauses just doesn't work.

Differential Revision: https://phabricator.services.mozilla.com/D21859
This commit is contained in:
Emilio Cobos Álvarez 2019-03-03 11:31:21 +00:00
parent 35b8b95263
commit 9b24a451f6
3 changed files with 76 additions and 0 deletions

View file

@ -9,6 +9,12 @@ use synstructure::BindStyle;
pub fn derive(mut input: DeriveInput) -> TokenStream {
let mut where_clause = input.generics.where_clause.take();
cg::propagate_clauses_to_output_type(
&mut where_clause,
&input.generics,
parse_quote!(crate::values::computed::ToComputedValue),
parse_quote!(ComputedValue),
);
let (to_body, from_body) = {
let params = input.generics.type_params().collect::<Vec<_>>();
for param in &params {