]> git.bitcoin.ninja Git - ldk-c-bindings/commitdiff
Print fewer types in call generics, leaning on rustc to pick types
authorMatt Corallo <git@bluematt.me>
Thu, 28 Sep 2023 01:16:56 +0000 (01:16 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 4 Oct 2023 20:02:23 +0000 (20:02 +0000)
Picking types is hard, its easier to make rustc do it.

c-bindings-gen/src/types.rs

index 9df1bd1c1ef309e13aef79f99072c3c265adf128..5f9e5812aa4a4cc56c97ad71fca2fe2bc81c3c8e 100644 (file)
@@ -3070,7 +3070,9 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
                                        // If this is a no-export'd crate and there's only one implementation in the
                                        // whole crate, just treat it as a reference to whatever the implementor is.
                                        if with_ref_lifetime {
-                                               write!(w, "&'static crate::{}", trait_impls[0]).unwrap();
+                                               // Hope we're being printed in function generics and let rustc derive the
+                                               // type.
+                                               write!(w, "_").unwrap();
                                        } else {
                                                write!(w, "&crate::{}", trait_impls[0]).unwrap();
                                        }