Skip to content

Commit

Permalink
Add missing clause on Fields structs.
Browse files Browse the repository at this point in the history
  • Loading branch information
someguynamedjosh committed Jul 23, 2023
1 parent ae95fd6 commit 4d76cbb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ouroboros_macro/src/generate/with_all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ pub fn make_with_all_function(
let mut field_assignments = Vec::new();
let mut mut_fields = Vec::new();
let mut mut_field_assignments = Vec::new();
let internal_struct = &info.internal_ident;
// I don't think the reverse is necessary but it does make the expanded code more uniform.
for field in info.fields.iter().rev() {
let field_name = &field.name;
Expand Down Expand Up @@ -72,12 +71,16 @@ pub fn make_with_all_function(
let generic_where = if let Some(clause) = &info.generics.where_clause {
let mut clause = clause.clone();
let extra: WhereClause = syn::parse_quote! { where #lifetime: 'this };
clause
.predicates
.push(extra.predicates.first().unwrap().clone());
let extra: WhereClause = syn::parse_quote! { where 'this: 'outer_borrow };
clause
.predicates
.push(extra.predicates.first().unwrap().clone());
clause
} else {
syn::parse_quote! { where #lifetime: 'this }
syn::parse_quote! { where #lifetime: 'this, 'this: 'outer_borrow }
};
let struct_defs = quote! {
#[doc=#struct_documentation]
Expand Down

0 comments on commit 4d76cbb

Please sign in to comment.