Skip to content

Commit 66f600e

Browse files
committed
Remove the CanDeriveDebug::Extra associated type
Similar to `HasVtable::Extra`, it is no longer needed.
1 parent d10b68e commit 66f600e

File tree

4 files changed

+5
-17
lines changed

4 files changed

+5
-17
lines changed

src/codegen/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1414,7 +1414,7 @@ impl CodeGenerator for CompInfo {
14141414

14151415
let is_union = self.kind() == CompKind::Union;
14161416
let mut derives = vec![];
1417-
if item.can_derive_debug(ctx, ()) {
1417+
if item.can_derive_debug(ctx) {
14181418
derives.push("Debug");
14191419
}
14201420

src/ir/context.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,8 @@ impl ItemId {
4040
}
4141

4242
impl CanDeriveDebug for ItemId {
43-
type Extra = ();
44-
45-
fn can_derive_debug(&self, ctx: &BindgenContext, _: ()) -> bool {
46-
ctx.resolve_item(*self).can_derive_debug(ctx, ())
43+
fn can_derive_debug(&self, ctx: &BindgenContext) -> bool {
44+
ctx.options().derive_debug && ctx.lookup_item_id_can_derive_debug(*self)
4745
}
4846
}
4947

src/ir/derive.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,9 @@ use super::context::BindgenContext;
1010
/// derive debug or not, because of the limit rust has on 32 items as max in the
1111
/// array.
1212
pub trait CanDeriveDebug {
13-
/// Implementations can define this type to get access to any extra
14-
/// information required to determine whether they can derive `Debug`. If
15-
/// extra information is unneeded, then this should simply be the unit type.
16-
type Extra;
17-
1813
/// Return `true` if `Debug` can be derived for this thing, `false`
1914
/// otherwise.
20-
fn can_derive_debug(&self,
21-
ctx: &BindgenContext,
22-
extra: Self::Extra)
23-
-> bool;
15+
fn can_derive_debug(&self, ctx: &BindgenContext) -> bool;
2416
}
2517

2618
/// A trait that encapsulates the logic for whether or not we can derive `Debug`.

src/ir/item.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,7 @@ impl Trace for Item {
271271
}
272272

273273
impl CanDeriveDebug for Item {
274-
type Extra = ();
275-
276-
fn can_derive_debug(&self, ctx: &BindgenContext, _: ()) -> bool {
274+
fn can_derive_debug(&self, ctx: &BindgenContext) -> bool {
277275
ctx.options().derive_debug && ctx.lookup_item_id_can_derive_debug(self.id())
278276
}
279277
}

0 commit comments

Comments
 (0)