Skip to content

Commit 072a9e1

Browse files
committed
Ignore Debug bounds on generics which may be redundant
1 parent 8fc17a2 commit 072a9e1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

c-bindings-gen/src/types.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,15 @@ impl<'a, 'p: 'a> GenericTypes<'a, 'p> {
223223
if let Some(path) = types.maybe_resolve_path(&trait_bound.path, None) {
224224
if types.skip_path(&path) { continue; }
225225
if path == "Sized" { continue; }
226+
if path == "core::fmt::Debug" {
227+
// #[derive(Debug)] will add Debug bounds on each genericin the
228+
// auto-generated impl. In cases where the existing generic
229+
// bound already requires Debug this is redundant and should be
230+
// ignored (which we do here). However, in cases where this is
231+
// not redundant, this may cause spurious Debug impls which may
232+
// fail to compile.
233+
continue;
234+
}
226235
if non_lifetimes_processed { return false; }
227236
non_lifetimes_processed = true;
228237
if path != "std::ops::Deref" && path != "core::ops::Deref" &&

0 commit comments

Comments
 (0)