Skip to content

Commit

Permalink
Unify derive logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Jethro Beekman committed Mar 21, 2019
1 parent 843eb1c commit 37dce66
Show file tree
Hide file tree
Showing 12 changed files with 773 additions and 2,069 deletions.
3 changes: 1 addition & 2 deletions src/codegen/impl_debug.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use ir::comp::{BitfieldUnit, CompKind, Field, FieldData, FieldMethods};
use ir::context::BindgenContext;
use ir::derive::CanTriviallyDeriveDebug;
use ir::item::{HasTypeParamInArray, IsOpaque, Item, ItemCanonicalName};
use ir::ty::{RUST_DERIVE_IN_ARRAY_LIMIT, TypeKind};
use proc_macro2;
Expand Down Expand Up @@ -236,7 +235,7 @@ impl<'a> ImplDebug<'a> for Item {
let inner_type = ctx.resolve_type(inner).canonical_type(ctx);
match *inner_type.kind() {
TypeKind::Function(ref sig)
if !sig.can_trivially_derive_debug(ctx) => {
if !sig.function_pointers_can_derive() => {
Some((format!("{}: FunctionPointer", name), vec![]))
}
_ => debug_print(name, quote! { #name_ident }),
Expand Down
2 changes: 1 addition & 1 deletion src/codegen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1746,7 +1746,7 @@ impl CodeGenerator for CompInfo {
needs_partialeq_impl =
ctx.options().derive_partialeq &&
ctx.options().impl_partialeq &&
ctx.lookup_can_derive_partialeq_or_partialord(item.id()) == CanDerive::ArrayTooLarge;
ctx.lookup_can_derive_partialeq_or_partialord(item.id()) == CanDerive::Manually;
}

if item.can_derive_eq(ctx) {
Expand Down
Loading

0 comments on commit 37dce66

Please sign in to comment.