X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-c-bindings;a=blobdiff_plain;f=c-bindings-gen%2Fsrc%2Fmain.rs;h=266bf5877508ec24133c5c009244a3162b1facf2;hp=49bc77435d024e78e86b081f695c2973a3c8724b;hb=59dfbf9845fec045d76da8d5a28483c470a2c4a1;hpb=3f4639631a9c9b80576e0963b13d50320640e0c6 diff --git a/c-bindings-gen/src/main.rs b/c-bindings-gen/src/main.rs index 49bc774..266bf58 100644 --- a/c-bindings-gen/src/main.rs +++ b/c-bindings-gen/src/main.rs @@ -597,7 +597,16 @@ fn writeln_trait<'a, 'b, W: std::io::Write>(w: &mut W, t: &'a syn::ItemTrait, ty (s, i) => { if let Some(supertrait) = types.crate_types.traits.get(s) { let resolver = get_module_type_resolver!(s, types.crate_libs, types.crate_types); - writeln!(w, "impl {} for {} {{", s, trait_name).unwrap(); + + // Blindly assume that the same imports where `supertrait` is defined are also + // imported here. This will almost certainly break at some point, but it should be + // a compilation failure when it does so. + write!(w, "impl").unwrap(); + maybe_write_lifetime_generics(w, &supertrait.generics, types); + write!(w, " {}", s).unwrap(); + maybe_write_generics(w, &supertrait.generics, types, false); + writeln!(w, " for {} {{", trait_name).unwrap(); + impl_trait_for_c!(supertrait, format!(".{}", i), &resolver); writeln!(w, "}}").unwrap(); } else {