From: Matt Corallo Date: Tue, 23 Jan 2024 20:01:23 +0000 (+0000) Subject: Ignore `Debug` bounds on generics which may be redundant X-Git-Tag: v0.0.121.0^2~6 X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-c-bindings;a=commitdiff_plain;h=072a9e1c2b85291f6acbf21ab83f38ecd6325cb5 Ignore `Debug` bounds on generics which may be redundant --- diff --git a/c-bindings-gen/src/types.rs b/c-bindings-gen/src/types.rs index 0c4c1d8..bd04ba2 100644 --- a/c-bindings-gen/src/types.rs +++ b/c-bindings-gen/src/types.rs @@ -223,6 +223,15 @@ impl<'a, 'p: 'a> GenericTypes<'a, 'p> { if let Some(path) = types.maybe_resolve_path(&trait_bound.path, None) { if types.skip_path(&path) { continue; } if path == "Sized" { continue; } + if path == "core::fmt::Debug" { + // #[derive(Debug)] will add Debug bounds on each genericin the + // auto-generated impl. In cases where the existing generic + // bound already requires Debug this is redundant and should be + // ignored (which we do here). However, in cases where this is + // not redundant, this may cause spurious Debug impls which may + // fail to compile. + continue; + } if non_lifetimes_processed { return false; } non_lifetimes_processed = true; if path != "std::ops::Deref" && path != "core::ops::Deref" &&