From: Matt Corallo Date: Wed, 22 Sep 2021 23:15:20 +0000 (+0000) Subject: Call methods explicitly on traits to avoid to deref recursion X-Git-Tag: v0.0.101.1~1^2~15 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=f381f78f749c4a2ba293f7b1ccfbef39a3a3291b;p=ldk-c-bindings Call methods explicitly on traits to avoid to deref recursion --- diff --git a/c-bindings-gen/src/types.rs b/c-bindings-gen/src/types.rs index 96a4135..efd6b9a 100644 --- a/c-bindings-gen/src/types.rs +++ b/c-bindings-gen/src/types.rs @@ -1922,7 +1922,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { DeclType::EnumIgnored|DeclType::StructImported if !is_ref => write!(w, "crate::{} {{ inner: ObjOps::heap_alloc(", decl_path).unwrap(), DeclType::Trait(_) if is_ref => write!(w, "").unwrap(), - DeclType::Trait(_) if !is_ref => {}, + DeclType::Trait(_) if !is_ref => write!(w, "Into::into(").unwrap(), _ => panic!("{:?}", decl_path), } }); @@ -1948,7 +1948,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { // for use when a Rust trait method returns an associated type. // Because all of our C traits implement From // we can just call .into() here and be done. - write!(w, ".into()").unwrap() + write!(w, ")").unwrap() }, _ => unimplemented!(), });