>,
saw_union: bool,
items_seen: HashSet >
- where F: FnOnce(&mut Self)
+ where F: FnOnce(&mut Self),
{
let mut new = Self::new();
@@ -135,7 +135,7 @@ impl ForeignModBuilder {
inner: ast::ForeignMod {
abi: abi,
items: vec![],
- }
+ },
}
}
@@ -146,7 +146,7 @@ impl ForeignModBuilder {
#[allow(dead_code)]
fn with_foreign_items(mut self, items: I) -> Self
- where I: IntoIterator > {
context.options().whitelisted_functions.is_empty() &&
context.options().whitelisted_vars.is_empty() {
for (_item_id, item) in context.items() {
- // Non-toplevel item parents are the responsible one for generating
- // them.
+ // Non-toplevel item parents are the responsible one for
+ // generating them.
if item.is_toplevel(context) {
item.codegen(context, &mut result, &());
}
@@ -1629,17 +1737,24 @@ pub fn codegen(context: &mut BindgenContext) -> Vec > {
if let TypeKind::Enum(ref enum_) = *ty.kind() {
if ty.name().is_none() {
if enum_.variants().iter().any(|variant| {
- context.options().whitelisted_vars.matches(&variant.name())
+ context.options()
+ .whitelisted_vars
+ .matches(&variant.name())
}) {
- item.collect_types(context, &mut items, &());
+ item.collect_types(context,
+ &mut items,
+ &());
}
}
}
}
ItemKind::Function(ref fun) => {
- if context.options().whitelisted_functions.matches(&name) {
+ if context.options()
+ .whitelisted_functions
+ .matches(&name) {
items.insert(item.id());
- fun.signature().collect_types(context, &mut items, &());
+ fun.signature()
+ .collect_types(context, &mut items, &());
}
}
ItemKind::Var(ref var) => {
@@ -1652,7 +1767,10 @@ pub fn codegen(context: &mut BindgenContext) -> Vec > {
}
}
- fn contains_parent(ctx: &BindgenContext, types: &ItemSet, id: ItemId) -> bool {
+ fn contains_parent(ctx: &BindgenContext,
+ types: &ItemSet,
+ id: ItemId)
+ -> bool {
let item = ctx.resolve_item(id);
let mut last = id;
let mut current = item.parent_id();
@@ -1670,7 +1788,8 @@ pub fn codegen(context: &mut BindgenContext) -> Vec > {
for item_id in items.iter() {
let item = context.resolve_item(*item_id);
- if item.is_toplevel(context) || !contains_parent(context, &items, *item_id) {
+ if item.is_toplevel(context) ||
+ !contains_parent(context, &items, *item_id) {
item.codegen(context, &mut result, &());
}
}
@@ -1685,21 +1804,23 @@ pub fn codegen(context: &mut BindgenContext) -> Vec > {
}
mod utils {
+ use aster;
use ir::context::BindgenContext;
use ir::item::{Item, ItemCanonicalPath, ItemId};
use ir::ty::TypeKind;
- use syntax::ast;
- use syntax::ptr::P;
use std::mem;
use super::ItemToRustTy;
- use aster;
+ use syntax::ast;
+ use syntax::ptr::P;
- pub fn prepend_union_types(ctx: &BindgenContext, result: &mut Vec >) {
+ pub fn prepend_union_types(ctx: &BindgenContext,
+ result: &mut Vec >) {
let union_field_decl = quote_item!(ctx.ext_cx(),
#[derive(Debug)]
#[repr(C)]
pub struct __BindgenUnionField > {
+ _inner: ItemId)
+ -> Option > {
// FIXME: We could use the inner item to check this is really a
// primitive type but, who the heck overrides these anyway?
macro_rules! ty {
@@ -1816,17 +1949,16 @@ mod utils {
"int64_t" => ty!(i64),
"uint64_t" => ty!(u64),
- "uintptr_t" |
- "size_t" => ty!(usize),
+ "uintptr_t" | "size_t" => ty!(usize),
- "intptr_t" |
- "ptrdiff_t" |
- "ssize_t" => ty!(isize),
+ "intptr_t" | "ptrdiff_t" | "ssize_t" => ty!(isize),
_ => return None,
})
}
- pub fn rust_fndecl_from_signature(ctx: &BindgenContext, sig: &Item) -> P(name: S,
default: Option(name: S, default: Option(name: S,
+ default: Option(id: ItemId, name: S, default: Option(id: ItemId,
+ name: S,
+ default: Option(&mut self, string: &S)
- where S: Borrow(&self, string: &S) -> bool
- where S: Borrow