summaryrefslogtreecommitdiff
path: root/libbindgen/src/codegen/mod.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-12-30 09:48:30 -0800
committerGitHub <noreply@github.com>2016-12-30 09:48:30 -0800
commit6940219984b9131e67688e78116dda4352164dfc (patch)
tree9ea988e4e947feb12ba702a8964e0e3cf4f6b913 /libbindgen/src/codegen/mod.rs
parent889361ad3bb266ddee6edf30ba4df458a9c44022 (diff)
parent50b5845c239e2a9ae8b9594bcbedf91174460e84 (diff)
Auto merge of #374 - fitzgen:derive-debug-with-array-too-big, r=emilio
Derive debug with array too big See the first commit's message for details, second commit is just `rustfmt`. r? @emilio Not quite sure whether the `Opaque` struct is fully motivated... it seems like it would be useful later on in codegen, but might not be pulling its own weight without more usage...
Diffstat (limited to 'libbindgen/src/codegen/mod.rs')
-rw-r--r--libbindgen/src/codegen/mod.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/libbindgen/src/codegen/mod.rs b/libbindgen/src/codegen/mod.rs
index ae59bc52..24b862be 100644
--- a/libbindgen/src/codegen/mod.rs
+++ b/libbindgen/src/codegen/mod.rs
@@ -6,6 +6,7 @@ use aster;
use ir::annotations::FieldAccessorKind;
use ir::comp::{CompInfo, CompKind, Field, Method, MethodKind};
use ir::context::{BindgenContext, ItemId};
+use ir::derive::{CanDeriveCopy, CanDeriveDebug};
use ir::enum_ty::{Enum, EnumVariant, EnumVariantValue};
use ir::function::{Function, FunctionSig};
use ir::int::IntKind;
@@ -765,12 +766,12 @@ impl CodeGenerator for CompInfo {
let is_union = self.kind() == CompKind::Union;
let mut derives = vec![];
- let ty = item.expect_type();
- if ty.can_derive_debug(ctx) {
+ if item.can_derive_debug(ctx, ()) {
derives.push("Debug");
}
- if item.can_derive_copy(ctx) && !item.annotations().disallow_copy() {
+ if item.can_derive_copy(ctx, ()) &&
+ !item.annotations().disallow_copy() {
derives.push("Copy");
if !applicable_template_args.is_empty() {
// FIXME: This requires extra logic if you have a big array in a
@@ -895,7 +896,7 @@ impl CodeGenerator for CompInfo {
// Try to catch a bitfield contination early.
if let (Some(ref mut bitfield_width), Some(width)) =
- (current_bitfield_width, field.bitfield()) {
+ (current_bitfield_width, field.bitfield()) {
let layout = current_bitfield_layout.unwrap();
debug!("Testing bitfield continuation {} {} {:?}",
*bitfield_width, width, layout);