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::animated::ToAnimatedValue),
parse_quote!(AnimatedValue),
);
for param in input.generics.type_params() {
cg::add_predicate(
&mut where_clause,