projects
/
ldk-c-bindings
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8fc17a2
)
Ignore `Debug` bounds on generics which may be redundant
author
Matt Corallo
<git@bluematt.me>
Tue, 23 Jan 2024 20:01:23 +0000
(20:01 +0000)
committer
Matt Corallo
<git@bluematt.me>
Tue, 23 Jan 2024 22:35:15 +0000
(22:35 +0000)
c-bindings-gen/src/types.rs
patch
|
blob
|
history
diff --git
a/c-bindings-gen/src/types.rs
b/c-bindings-gen/src/types.rs
index 0c4c1d88694e3c5637cd60efb108ef9806894b1c..bd04ba2b8c590889b2b5c4f74b5ffa32f2637cb6 100644
(file)
--- 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 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" &&
if non_lifetimes_processed { return false; }
non_lifetimes_processed = true;
if path != "std::ops::Deref" && path != "core::ops::Deref" &&