diff --git a/compiler/noirc_frontend/src/elaborator/traits.rs b/compiler/noirc_frontend/src/elaborator/traits.rs index f08c13834b2..77948b0e8fe 100644 --- a/compiler/noirc_frontend/src/elaborator/traits.rs +++ b/compiler/noirc_frontend/src/elaborator/traits.rs @@ -110,6 +110,8 @@ impl<'context> Elaborator<'context> { { self.recover_generics(|this| { let the_trait = this.interner.get_trait(trait_id); + let the_trait_where_clause = the_trait.where_clause.clone(); + let the_trait_constraint = the_trait.as_constraint(the_trait.name.span()); let self_typevar = the_trait.self_type_typevar.clone(); let name_span = the_trait.name.span(); @@ -146,7 +148,9 @@ impl<'context> Elaborator<'context> { this.interner.set_doc_comments(id, item.doc_comments.clone()); } - let func_meta = this.interner.function_meta(&func_id); + let func_meta = this.interner.function_meta_mut(&func_id); + func_meta.trait_constraints.push(the_trait_constraint); + func_meta.trait_constraints.extend(the_trait_where_clause); let arguments = vecmap(&func_meta.parameters.0, |(_, typ, _)| typ.clone()); let return_type = func_meta.return_type().clone();