Add partially-working where bounds for associated types

This commit is contained in:
Osspial
2018-04-09 23:22:18 -04:00
parent 5efb22ebee
commit c413775574
3 changed files with 21 additions and 8 deletions
+4 -3
View File
@@ -124,7 +124,9 @@ impl Parameters {
fn build_generics(cont: &Container, borrowed: &BorrowedLifetimes) -> syn::Generics {
let generics = bound::without_defaults(cont.generics);
let generics = bound::with_where_predicates_from_fields(cont, &generics, attr::Field::de_bound);
let delife = borrowed.de_lifetime();
let de_bound = parse_quote!(_serde::Deserialize<#delife>);
let generics = bound::with_where_predicates_from_fields(cont, &generics, &de_bound, attr::Field::de_bound, attr::Field::deserialize_with);
match cont.attrs.de_bound() {
Some(predicates) => bound::with_where_predicates(&generics, predicates),
@@ -136,12 +138,11 @@ fn build_generics(cont: &Container, borrowed: &BorrowedLifetimes) -> syn::Generi
attr::Default::None | attr::Default::Path(_) => generics,
};
let delife = borrowed.de_lifetime();
let generics = bound::with_bound(
cont,
&generics,
needs_deserialize_bound,
&parse_quote!(_serde::Deserialize<#delife>),
&de_bound,
);
bound::with_bound(