summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-07-27 16:42:44 -0500
committerGitHub <noreply@github.com>2017-07-27 16:42:44 -0500
commit0fab51e501f45727169516f605de31e7e1d19a62 (patch)
treed879d4c8fe4f87d0f185927fcbf621ba6b322018
parent331862adaf29c3a73db4156fd346b7755123fa3e (diff)
parent66f600eed117b9f7f5197ce1e3429539aac24365 (diff)
Auto merge of #862 - fitzgen:remove-unused-extra, r=emilio
Remove unused `Extra` associated types r? @photoszzt or @emilio
-rw-r--r--src/codegen/mod.rs2
-rw-r--r--src/ir/analysis/has_vtable.rs8
-rw-r--r--src/ir/context.rs6
-rw-r--r--src/ir/derive.rs10
-rw-r--r--src/ir/item.rs12
-rw-r--r--src/ir/ty.rs10
6 files changed, 9 insertions, 39 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs
index 05e16a5b..4ae0bfeb 100644
--- a/src/codegen/mod.rs
+++ b/src/codegen/mod.rs
@@ -1414,7 +1414,7 @@ impl CodeGenerator for CompInfo {
let is_union = self.kind() == CompKind::Union;
let mut derives = vec![];
- if item.can_derive_debug(ctx, ()) {
+ if item.can_derive_debug(ctx) {
derives.push("Debug");
}
diff --git a/src/ir/analysis/has_vtable.rs b/src/ir/analysis/has_vtable.rs
index 47c9ee15..a1573077 100644
--- a/src/ir/analysis/has_vtable.rs
+++ b/src/ir/analysis/has_vtable.rs
@@ -157,12 +157,6 @@ impl<'ctx, 'gen> From<HasVtableAnalysis<'ctx, 'gen>> for HashSet<ItemId> {
/// looking up the results of the HasVtableAnalysis's computations for a
/// specific thing.
pub trait HasVtable {
-
- /// Implementations can define this type to get access to any extra
- /// information required to determine whether they have vtable. If
- /// extra information is unneeded, then this should simply be the unit type.
- type Extra;
-
/// Return `true` if this thing has vtable, `false` otherwise.
- fn has_vtable(&self, ctx: &BindgenContext, extra: &Self::Extra) -> bool;
+ fn has_vtable(&self, ctx: &BindgenContext) -> bool;
}
diff --git a/src/ir/context.rs b/src/ir/context.rs
index 3232e8e6..6c38e8e7 100644
--- a/src/ir/context.rs
+++ b/src/ir/context.rs
@@ -40,10 +40,8 @@ impl ItemId {
}
impl CanDeriveDebug for ItemId {
- type Extra = ();
-
- fn can_derive_debug(&self, ctx: &BindgenContext, _: ()) -> bool {
- ctx.resolve_item(*self).can_derive_debug(ctx, ())
+ fn can_derive_debug(&self, ctx: &BindgenContext) -> bool {
+ ctx.options().derive_debug && ctx.lookup_item_id_can_derive_debug(*self)
}
}
diff --git a/src/ir/derive.rs b/src/ir/derive.rs
index 446d2435..3334618c 100644
--- a/src/ir/derive.rs
+++ b/src/ir/derive.rs
@@ -10,17 +10,9 @@ use super::context::BindgenContext;
/// derive debug or not, because of the limit rust has on 32 items as max in the
/// array.
pub trait CanDeriveDebug {
- /// Implementations can define this type to get access to any extra
- /// information required to determine whether they can derive `Debug`. If
- /// extra information is unneeded, then this should simply be the unit type.
- type Extra;
-
/// Return `true` if `Debug` can be derived for this thing, `false`
/// otherwise.
- fn can_derive_debug(&self,
- ctx: &BindgenContext,
- extra: Self::Extra)
- -> bool;
+ fn can_derive_debug(&self, ctx: &BindgenContext) -> bool;
}
/// A trait that encapsulates the logic for whether or not we can derive `Debug`.
diff --git a/src/ir/item.rs b/src/ir/item.rs
index b3a26bb7..92954a8f 100644
--- a/src/ir/item.rs
+++ b/src/ir/item.rs
@@ -271,9 +271,7 @@ impl Trace for Item {
}
impl CanDeriveDebug for Item {
- type Extra = ();
-
- fn can_derive_debug(&self, ctx: &BindgenContext, _: ()) -> bool {
+ fn can_derive_debug(&self, ctx: &BindgenContext) -> bool {
ctx.options().derive_debug && ctx.lookup_item_id_can_derive_debug(self.id())
}
}
@@ -949,17 +947,13 @@ impl IsOpaque for Item {
}
impl HasVtable for ItemId {
- type Extra = ();
-
- fn has_vtable(&self, ctx: &BindgenContext, _: &()) -> bool {
+ fn has_vtable(&self, ctx: &BindgenContext) -> bool {
ctx.lookup_item_id_has_vtable(self)
}
}
impl HasVtable for Item {
- type Extra = ();
-
- fn has_vtable(&self, ctx: &BindgenContext, _: &()) -> bool {
+ fn has_vtable(&self, ctx: &BindgenContext) -> bool {
ctx.lookup_item_id_has_vtable(&self.id())
}
}
diff --git a/src/ir/ty.rs b/src/ir/ty.rs
index b189ceac..1c213569 100644
--- a/src/ir/ty.rs
+++ b/src/ir/ty.rs
@@ -2,7 +2,7 @@
use super::comp::CompInfo;
use super::context::{BindgenContext, ItemId};
-use super::derive::{CanDeriveCopy, CanDeriveDebug, CanDeriveDefault};
+use super::derive::{CanDeriveCopy, CanDeriveDefault};
use super::dot::DotAttributes;
use super::enum_ty::Enum;
use super::function::FunctionSig;
@@ -526,14 +526,6 @@ impl TemplateParameters for TypeKind {
}
}
-impl CanDeriveDebug for Type {
- type Extra = Item;
-
- fn can_derive_debug(&self, ctx: &BindgenContext, item: Item) -> bool {
- ctx.lookup_item_id_can_derive_debug(item.id())
- }
-}
-
impl<'a> CanDeriveDefault<'a> for Type {
type Extra = &'a Item;