mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
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:
parent
35b8b95263
commit
9b24a451f6
3 changed files with 76 additions and 0 deletions
|
@ -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 ¶ms {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue