]> git.bitcoin.ninja Git - ldk-c-bindings/commitdiff
Handle printing generic bounds on a trait impl better
authorMatt Corallo <git@bluematt.me>
Thu, 22 Aug 2024 22:59:49 +0000 (22:59 +0000)
committerMatt Corallo <git@bluematt.me>
Sat, 24 Aug 2024 17:11:07 +0000 (17:11 +0000)
c-bindings-gen/src/types.rs

index 877331e88a6e2eb04133a97fafd6d0c466d59ed0..51efa247a73514eee5c2e4bede5bc796780cf529 100644 (file)
@@ -3127,9 +3127,8 @@ 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 {
-                                               // Hope we're being printed in function generics and let rustc derive the
-                                               // type.
-                                               write!(w, "_").unwrap();
+                                               // Hope that we're bound on a `Deref` and that the non-ref type works.
+                                               write!(w, "crate::{}", trait_impls[0]).unwrap();
                                        } else {
                                                write!(w, "&crate::{}", trait_impls[0]).unwrap();
                                        }