Skip to content

Commit

Permalink
Auto merge of rust-lang#1119 - pepyakin:derive-partialeq-partialord-r…
Browse files Browse the repository at this point in the history
…efactoring, r=emilio

Simple refactoring of derive_partialeq_or_partialord

Just simple refactoring with some tricks from rust-lang#1102

r? @fitzgen
  • Loading branch information
bors-servo authored Oct 30, 2017
2 parents 33c6f26 + 230545e commit 3d623d3
Show file tree
Hide file tree
Showing 8 changed files with 187 additions and 157 deletions.
7 changes: 2 additions & 5 deletions src/codegen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use ir::comp::{Base, Bitfield, BitfieldUnit, CompInfo, CompKind, Field,
use ir::context::{BindgenContext, ItemId};
use ir::derive::{CanDeriveCopy, CanDeriveDebug, CanDeriveDefault,
CanDeriveHash, CanDerivePartialOrd, CanDeriveOrd,
CanDerivePartialEq, CanDeriveEq, CannotDeriveReason};
CanDerivePartialEq, CanDeriveEq, CanDerive};
use ir::dot;
use ir::enum_ty::{Enum, EnumVariant, EnumVariantValue};
use ir::function::{Abi, Function, FunctionSig, Linkage};
Expand Down Expand Up @@ -1676,10 +1676,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())
.map_or(true, |x| {
x == CannotDeriveReason::ArrayTooLarge
});
ctx.lookup_can_derive_partialeq_or_partialord(item.id()) == CanDerive::ArrayTooLarge;
}

if item.can_derive_eq(ctx) {
Expand Down
Loading

0 comments on commit 3d623d3

Please sign in to comment.