diff options
author | Emilio Cobos Álvarez <ecoal95@gmail.com> | 2016-07-09 13:04:29 -0700 |
---|---|---|
committer | Emilio Cobos Álvarez <ecoal95@gmail.com> | 2016-07-10 14:02:24 -0700 |
commit | 666b7b4194fc25dfdd7b002841ec85833a462ec9 (patch) | |
tree | 32edf0e05aea9e86bc17c01614108afbd242a209 | |
parent | 32313ecece3cb76b2e7de7b49cc9c07553a23e9b (diff) |
Use aster and quasi to allow building with stable Rust.
72 files changed, 126 insertions, 248 deletions
@@ -11,12 +11,17 @@ keywords = [ "bindings", "ffi", "code-generation" ] build = "build.rs" [dependencies] +aster = { version = "0.21.1", features = ["with-syntex"] } +quasi = { version = "0.15", features = ["with-syntex"] } clippy = { version = "*", optional = true } +syntex_syntax = "0.38" log = "0.3.*" libc = "0.2.*" -syntex_syntax = "0.37" clang-sys = "0.7.2" +[build-dependencies] +quasi_codegen = "0.15" + [features] static = [] llvm_stable = [] @@ -21,11 +21,27 @@ const MAC_CLANG_DIR: &'static [&'static str] = &[ ]; const WIN_CLANG_DIRS: &'static [&'static str] = &["C:\\Program Files\\LLVM\\bin", "C:\\Program Files\\LLVM\\lib"]; -fn path_exists(path: &Path) -> bool { - fs::metadata(path).is_ok() +mod codegen { + extern crate quasi_codegen; + use std::path::Path; + use std::env; + + pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + let src = Path::new("src/gen.rs"); + let dst = Path::new(&out_dir).join("gen.rs"); + + quasi_codegen::expand(&src, &dst).unwrap(); + println!("cargo:rerun-if-changed=src/gen.rs"); + } } fn main() { + codegen::main(); + search_libclang(); +} + +fn search_libclang() { let use_static_lib = env::var_os("LIBCLANG_STATIC").is_some() || cfg!(feature = "static"); let possible_clang_dirs = if let Ok(dir) = env::var("LIBCLANG_PATH") { @@ -153,3 +169,7 @@ fn main() { panic!("Unable to find {}", clang_lib); } } + +fn path_exists(path: &Path) -> bool { + fs::metadata(path).is_ok() +} diff --git a/src/bin/bindgen.rs b/src/bin/bindgen.rs index 1fcd9dfd..7ad4d07f 100644 --- a/src/bin/bindgen.rs +++ b/src/bin/bindgen.rs @@ -125,6 +125,10 @@ fn parse_args(args: &[String]) -> ParseResult { options.namespaced_constants = false; ix += 1; } + "-no-unstable-rust" => { + options.unstable_rust = false; + ix += 1; + } "-no-class-constants" => { options.class_constants = false; ix += 1; @@ -20,6 +20,7 @@ use syntax::print::pprust::tts_to_string; use super::BindgenOptions; use super::LinkType; use types::*; +use aster; struct GenCtx<'r> { ext_cx: base::ExtCtxt<'r>, @@ -67,17 +68,6 @@ fn ref_eq<T>(thing: &T, other: &T) -> bool { (thing as *const T) == (other as *const T) } -fn empty_generics() -> ast::Generics { - ast::Generics { - lifetimes: vec![], - ty_params: P::new(), - where_clause: ast::WhereClause { - id: ast::DUMMY_NODE_ID, - predicates: vec![] - } - } -} - fn rust_id(ctx: &mut GenCtx, name: &str) -> (String, bool) { let token = parse::token::Ident(ctx.ext_cx.ident_of(name)); if token.is_any_keyword() || "bool" == name { @@ -181,20 +171,9 @@ fn gen_unmangle_method(ctx: &mut GenCtx, } else { first(rust_id(ctx, &n)) }; - let expr = ast::Expr { - id: ast::DUMMY_NODE_ID, - node: ast::ExprKind::Path(None, ast::Path { - span: ctx.span, - global: false, - segments: vec!(ast::PathSegment { - identifier: ctx.ext_cx.ident_of(&argname), - parameters: ast::PathParameters::none() - }) - }), - span: ctx.span, - attrs: ast::ThinVec::new(), - }; - args.push(P(expr)); + let expr = aster::AstBuilder::new().expr().path() + .segment(&argname).build().build(); + args.push(expr); } }, _ => unreachable!() @@ -231,7 +210,7 @@ fn gen_unmangle_method(ctx: &mut GenCtx, unsafety: ast::Unsafety::Unsafe, abi: Abi::Rust, decl: P(fndecl), - generics: empty_generics(), + generics: ast::Generics::default(), constness: ast::Constness::NotConst, }; @@ -369,7 +348,8 @@ fn gen_mod(mut ctx: &mut GenCtx, let mut globals = if module_id != ROOT_MODULE_ID { // XXX Pass this previously instead of looking it up always? let root_ident = ctx.ext_cx.ident_of(&ctx.module_map.get(&ROOT_MODULE_ID).unwrap().name); - vec![quote_item!(&ctx.ext_cx, use $root_ident;).unwrap()] + let root_use = quote_item!(&ctx.ext_cx, use $root_ident;).unwrap(); + vec![root_use] } else { vec![] }; @@ -444,7 +424,7 @@ fn gen_global(mut ctx: &mut GenCtx, GVar(vi) => { let v = vi.borrow(); let ty = cty_to_rs(&mut ctx, &v.ty, v.is_const, true); - defs.push(const_to_rs(&mut ctx, v.name.clone(), v.val.unwrap(), ty)); + defs.push(const_to_rs(&mut ctx, &v.name, v.val.unwrap(), ty)); }, _ => { } } @@ -617,26 +597,10 @@ fn mk_extern(ctx: &mut GenCtx, links: &[(String, LinkType)], }) } -fn mk_impl(ctx: &mut GenCtx, ty: P<ast::Ty>, +fn mk_impl(_ctx: &mut GenCtx, ty: P<ast::Ty>, items: Vec<ast::ImplItem>) -> P<ast::Item> { - let ext = ast::ItemKind::Impl( - ast::Unsafety::Normal, - ast::ImplPolarity::Positive, - empty_generics(), - None, - ty, - items - ); - - P(ast::Item { - ident: ctx.ext_cx.ident_of(""), - attrs: vec![], - id: ast::DUMMY_NODE_ID, - node: ext, - vis: ast::Visibility::Inherited, - span: ctx.span - }) + aster::AstBuilder::new().item().impl_().with_items(items).build_ty(ty) } fn remove_redundant_decl(gs: Vec<Global>) -> Vec<Global> { @@ -792,23 +756,9 @@ fn ctypedef_to_rs(ctx: &mut GenCtx, ty: TypeInfo) -> Vec<P<ast::Item>> { } else { cty_to_rs(ctx, &TVoid, true, true) }; - let base = ast::ItemKind::Ty( - P(ast::Ty { - id: ast::DUMMY_NODE_ID, - node: rust_ty.node, - span: ctx.span, - }), - empty_generics() - ); - - P(ast::Item { - ident: ctx.ext_cx.ident_of(&rust_name), - attrs: mk_doc_attr(ctx, comment), - id: ast::DUMMY_NODE_ID, - node: base, - vis: ast::Visibility::Public, - span: ctx.span - }) + aster::AstBuilder::new().item().pub_() + .with_attrs(mk_doc_attr(ctx, comment)) + .type_(&rust_name).build_ty(P(rust_ty)) } if ty.opaque { @@ -960,17 +910,12 @@ fn cstruct_to_rs(ctx: &mut GenCtx, name: &str, ci: CompInfo) -> Vec<P<ast::Item> } let vf_name = format!("_vftable_{}", name); - let item = P(ast::Item { - ident: ctx.ext_cx.ident_of(&vf_name), - attrs: vec!(mk_repr_attr(ctx, &layout)), - id: ast::DUMMY_NODE_ID, - node: ast::ItemKind::Struct( - ast::VariantData::Struct(vffields, ast::DUMMY_NODE_ID), - empty_generics() - ), - vis: ast::Visibility::Public, - span: ctx.span, - }); + let item = aster::AstBuilder::new().item() + .with_attr(mk_repr_attr(ctx, &layout)) + .pub_() + .struct_(&vf_name) + .with_fields(vffields).build(); + extra.push(item); if base_vftable.is_none() { @@ -1138,6 +1083,7 @@ fn cstruct_to_rs(ctx: &mut GenCtx, name: &str, ci: CompInfo) -> Vec<P<ast::Item> let f_name = format!("_phantom{}", phantom_count); phantom_count += 1; let inner_type = P(cty_to_rs(ctx, &arg, true, false)); + fields.push(ast::StructField { span: ctx.span, ident: Some(ctx.ext_cx.ident_of(&f_name)), @@ -1149,21 +1095,7 @@ fn cstruct_to_rs(ctx: &mut GenCtx, name: &str, ci: CompInfo) -> Vec<P<ast::Item> } if !setters.is_empty() { - extra.push(P(ast::Item { - ident: ctx.ext_cx.ident_of(""), - attrs: vec![], - id: ast::DUMMY_NODE_ID, - node: ast::ItemKind::Impl( - ast::Unsafety::Normal, - ast::ImplPolarity::Positive, - empty_generics(), - None, - id_ty.clone(), - setters - ), - vis: ast::Visibility::Inherited, - span: ctx.span - })); + extra.push(mk_impl(ctx, id_ty.clone(), setters)); } let field_count = fields.len(); @@ -1198,24 +1130,9 @@ fn cstruct_to_rs(ctx: &mut GenCtx, name: &str, ci: CompInfo) -> Vec<P<ast::Item> span: ctx.span }; - let mut items = vec!(P(struct_def)); + let mut items = vec![P(struct_def)]; if !methods.is_empty() { - let impl_ = ast::ItemKind::Impl( - ast::Unsafety::Normal, - ast::ImplPolarity::Positive, - empty_generics(), - None, - id_ty.clone(), - methods - ); - items.push( - P(ast::Item { - ident: ctx.ext_cx.ident_of(&name), - attrs: vec![], - id: ast::DUMMY_NODE_ID, - node: impl_, - vis: ast::Visibility::Inherited, - span: ctx.span})); + items.push(mk_impl(ctx, id_ty.clone(), methods)); } // Template args have incomplete type in general @@ -1280,23 +1197,10 @@ fn cstruct_to_rs(ctx: &mut GenCtx, name: &str, ci: CompInfo) -> Vec<P<ast::Item> } fn opaque_to_rs(ctx: &mut GenCtx, name: &str, _layout: Layout) -> P<ast::Item> { - let def = ast::ItemKind::Enum( - ast::EnumDef { - variants: vec![] - }, - empty_generics() - ); - // XXX can't repr(C) an empty enum let id = rust_type_id(ctx, name); - P(ast::Item { - ident: ctx.ext_cx.ident_of(&id), - attrs: vec![], - id: ast::DUMMY_NODE_ID, - node: def, - vis: ast::Visibility::Public, - span: ctx.span - }) + let ident = ctx.ext_cx.ident_of(&id); + quote_item!(&ctx.ext_cx, pub enum $ident {}).unwrap() } fn cunion_to_rs(ctx: &mut GenCtx, name: &str, ci: CompInfo) -> Vec<P<ast::Item>> { @@ -1355,9 +1259,10 @@ fn cunion_to_rs(ctx: &mut GenCtx, name: &str, ci: CompInfo) -> Vec<P<ast::Item>> }).collect::<Vec<_>>(); fields.push(mk_blob_field(ctx, UNION_DATA_FIELD_NAME, layout)); + // TODO: use aster here. let def = ast::ItemKind::Struct( ast::VariantData::Struct(fields, ast::DUMMY_NODE_ID), - empty_generics() + ast::Generics::default() ); let union_id = rust_type_id(ctx, name); @@ -1370,7 +1275,7 @@ fn cunion_to_rs(ctx: &mut GenCtx, name: &str, ci: CompInfo) -> Vec<P<ast::Item>> let union_impl = ast::ItemKind::Impl( ast::Unsafety::Normal, ast::ImplPolarity::Positive, - empty_generics(), + ast::Generics::default(), None, P(cty_to_rs(ctx, &union, true, true)), gen_comp_methods(ctx, UNION_DATA_FIELD_NAME, 0, CompKind::Union, &members, &mut extra), @@ -1384,31 +1289,11 @@ fn cunion_to_rs(ctx: &mut GenCtx, name: &str, ci: CompInfo) -> Vec<P<ast::Item>> items } -fn const_to_rs(ctx: &mut GenCtx, name: String, val: i64, val_ty: ast::Ty) -> P<ast::Item> { - let int_lit = ast::LitKind::Int( - val.abs() as u64, - ast::LitIntType::Unsuffixed - ); - let mut value = ctx.ext_cx.expr_lit(ctx.span, int_lit); - if val < 0 { - let negated = ast::ExprKind::Unary(ast::UnOp::Neg, value); - value = ctx.ext_cx.expr(ctx.span, negated); - } - - let cst = ast::ItemKind::Const( - P(val_ty), - value - ); - - let id = first(rust_id(ctx, &name)); - P(ast::Item { - ident: ctx.ext_cx.ident_of(&id[..]), - attrs: vec![], - id: ast::DUMMY_NODE_ID, - node: cst, - vis: ast::Visibility::Public, - span: ctx.span - }) +fn const_to_rs(ctx: &mut GenCtx, name: &str, val: i64, val_ty: ast::Ty) -> P<ast::Item> { + let id = first(rust_id(ctx, name)); + aster::AstBuilder::new().item().pub_().const_(&id) + .expr().int(val) + .ty().build(P(val_ty)) } fn enum_size_to_unsigned_max_value(size: usize) -> u64 { @@ -1473,11 +1358,6 @@ fn cenum_to_rs(ctx: &mut GenCtx, let enum_is_signed = kind.is_signed(); let enum_repr = enum_size_to_rust_type_name(enum_is_signed, layout.size); - // Rust is not happy with univariant enums - // if items.len() < 2 { - // return vec![]; - // } - // let mut items = vec![]; if !ctx.options.rust_enums { @@ -1547,7 +1427,7 @@ fn cenum_to_rs(ctx: &mut GenCtx, ident: enum_name, attrs: attrs, id: ast::DUMMY_NODE_ID, - node: ast::ItemKind::Enum(ast::EnumDef { variants: variants }, empty_generics()), + node: ast::ItemKind::Enum(ast::EnumDef { variants: variants }, ast::Generics::default()), vis: ast::Visibility::Public, span: ctx.span, })); @@ -1755,13 +1635,20 @@ fn gen_fullbitfield_method(ctx: &mut GenCtx, bindgen_name: &String, span: ctx.span }; + let mut attrs = vec![]; + let node = ast::ImplItemKind::Method( ast::MethodSig { unsafety: ast::Unsafety::Normal, abi: Abi::Rust, decl: P(fndecl), - generics: empty_generics(), - constness: ast::Constness::Const, + generics: ast::Generics::default(), + constness: if ctx.options.unstable_rust { + ast::Constness::Const + } else { + attrs.push(quote_attr!(&ctx.ext_cx, #[inline])); + ast::Constness::NotConst + }, }, P(block) ); @@ -1769,7 +1656,7 @@ fn gen_fullbitfield_method(ctx: &mut GenCtx, bindgen_name: &String, id: ast::DUMMY_NODE_ID, ident: ctx.ext_cx.ident_of(&format!("new{}", bindgen_name)), vis: ast::Visibility::Public, - attrs: vec![], + attrs: attrs, node: node, span: ctx.span, defaultness: ast::Defaultness::Final, @@ -1977,7 +1864,7 @@ fn cfunc_to_rs(ctx: &mut GenCtx, let var = !aty.is_empty() && var; let decl = ast::ForeignItemKind::Fn( P(cfuncty_to_rs(ctx, rty, aty, var)), - empty_generics() + ast::Generics::default() ); let (rust_name, was_mangled) = rust_id(ctx, &name); @@ -2264,7 +2151,9 @@ fn mk_test_fn(ctx: &GenCtx, name: &str, layout: &Layout) -> P<ast::Item> { let size = layout.size; let align = layout.align; let struct_name = ctx.ext_cx.ident_of(name); + let fn_name = ctx.ext_cx.ident_of(&format!("bindgen_test_layout_{}", name)); + let size_of_expr = quote_expr!(&ctx.ext_cx, ::std::mem::size_of::<$struct_name>()); let align_of_expr = quote_expr!(&ctx.ext_cx, ::std::mem::align_of::<$struct_name>()); let item = quote_item!(&ctx.ext_cx, @@ -2339,13 +2228,13 @@ fn gen_union_field_definitions_if_necessary(ctx: &mut GenCtx, mut root_mod: &mut return; } - let union_fields_decl = quote_item!(&ctx.ext_cx, + let union_field_decl = quote_item!(&ctx.ext_cx, #[derive(Copy, Debug)] #[repr(C)] pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>); ).unwrap(); - let union_fields_impl = quote_item!(&ctx.ext_cx, + let union_field_impl = quote_item!(&ctx.ext_cx, impl<T> __BindgenUnionField<T> { #[inline] pub fn new() -> Self { @@ -2364,7 +2253,7 @@ fn gen_union_field_definitions_if_necessary(ctx: &mut GenCtx, mut root_mod: &mut } ).unwrap(); - let union_fields_default_impl = quote_item!(&ctx.ext_cx, + let union_field_default_impl = quote_item!(&ctx.ext_cx, impl<T> ::std::default::Default for __BindgenUnionField<T> { #[inline] fn default() -> Self { @@ -2373,7 +2262,7 @@ fn gen_union_field_definitions_if_necessary(ctx: &mut GenCtx, mut root_mod: &mut } ).unwrap(); - let union_fields_clone_impl = quote_item!(&ctx.ext_cx, + let union_field_clone_impl = quote_item!(&ctx.ext_cx, impl<T> ::std::clone::Clone for __BindgenUnionField<T> { #[inline] fn clone(&self) -> Self { @@ -2382,10 +2271,10 @@ fn gen_union_field_definitions_if_necessary(ctx: &mut GenCtx, mut root_mod: &mut } ).unwrap(); - + let items = vec![union_field_decl, union_field_impl, union_field_default_impl, union_field_clone_impl]; match root_mod.node { ast::ItemKind::Mod(ref mut root) => { - let old_items = std::mem::replace(&mut root.items, vec![union_fields_decl, union_fields_impl, union_fields_default_impl, union_fields_clone_impl]); + let old_items = std::mem::replace(&mut root.items, items); root.items.extend(old_items.into_iter()); } _ => unreachable!(), diff --git a/src/hacks/mod.rs b/src/hacks/mod.rs new file mode 100644 index 00000000..79339002 --- /dev/null +++ b/src/hacks/mod.rs @@ -0,0 +1 @@ +pub mod refcell; @@ -1,11 +1,12 @@ #![crate_name = "bindgen"] #![crate_type = "dylib"] -#![feature(quote)] #![cfg_attr(feature = "clippy", feature(plugin))] #![cfg_attr(feature = "clippy", plugin(clippy))] extern crate syntex_syntax as syntax; +extern crate aster; +extern crate quasi; extern crate clang_sys; extern crate libc; #[macro_use] @@ -28,8 +29,11 @@ use types::ModuleMap; mod types; mod clangll; mod clang; -mod gen; mod parser; +mod hacks; +mod gen { + include!(concat!(env!("OUT_DIR"), "/gen.rs")); +} #[derive(Clone)] pub struct Builder<'a> { @@ -106,6 +110,10 @@ impl<'a> Builder<'a> { self } + pub fn no_unstable_rust(&mut self) -> &mut Self { + self.options.unstable_rust = false; + self + } pub fn rust_enums(&mut self, value: bool) -> &mut Self { self.options.rust_enums = value; self @@ -156,7 +164,9 @@ pub struct BindgenOptions { pub enable_cxx_namespaces: bool, pub rename_types: bool, pub derive_debug: bool, - /// Wether to generate C++ class constants. + /// Generate or not only stable rust. + pub unstable_rust: bool, + /// Whether to generate C++ class constants. pub class_constants: bool, /// Wether to generate names that are **directly** under namespaces. pub namespaced_constants: bool, @@ -184,6 +194,7 @@ impl Default for BindgenOptions { derive_debug: true, enable_cxx_namespaces: false, override_enum_ty: "".to_string(), + unstable_rust: true, class_constants: true, namespaced_constants: true, raw_lines: vec![], diff --git a/tests/expectations/annotation_hide.rs b/tests/expectations/annotation_hide.rs index 9d4d1ee8..14ba8310 100644 --- a/tests/expectations/annotation_hide.rs +++ b/tests/expectations/annotation_hide.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/class.rs b/tests/expectations/class.rs index 560c315c..450a57a6 100644 --- a/tests/expectations/class.rs +++ b/tests/expectations/class.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/class_nested.rs b/tests/expectations/class_nested.rs index 0cec8d2e..22e72209 100644 --- a/tests/expectations/class_nested.rs +++ b/tests/expectations/class_nested.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/class_no_members.rs b/tests/expectations/class_no_members.rs index 77902d62..8468c02b 100644 --- a/tests/expectations/class_no_members.rs +++ b/tests/expectations/class_no_members.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/class_static.rs b/tests/expectations/class_static.rs index f97875e9..8aa156d8 100644 --- a/tests/expectations/class_static.rs +++ b/tests/expectations/class_static.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/class_use_as.rs b/tests/expectations/class_use_as.rs index eb150c3d..4d06feca 100644 --- a/tests/expectations/class_use_as.rs +++ b/tests/expectations/class_use_as.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/class_with_dtor.rs b/tests/expectations/class_with_dtor.rs index 983b41df..3cc48dfb 100644 --- a/tests/expectations/class_with_dtor.rs +++ b/tests/expectations/class_with_dtor.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/class_with_inner_struct.rs b/tests/expectations/class_with_inner_struct.rs index d045e911..b465a183 100644 --- a/tests/expectations/class_with_inner_struct.rs +++ b/tests/expectations/class_with_inner_struct.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/class_with_typedef.rs b/tests/expectations/class_with_typedef.rs index 328ef2a0..44bce6d7 100644 --- a/tests/expectations/class_with_typedef.rs +++ b/tests/expectations/class_with_typedef.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/decl_ptr_to_array.rs b/tests/expectations/decl_ptr_to_array.rs index 74054fdd..e7dabeee 100644 --- a/tests/expectations/decl_ptr_to_array.rs +++ b/tests/expectations/decl_ptr_to_array.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/duplicated_constants_in_ns.rs b/tests/expectations/duplicated_constants_in_ns.rs index 3f7fefe6..b4b7b2bc 100644 --- a/tests/expectations/duplicated_constants_in_ns.rs +++ b/tests/expectations/duplicated_constants_in_ns.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/enum.rs b/tests/expectations/enum.rs index 23a599b9..f6f510dd 100644 --- a/tests/expectations/enum.rs +++ b/tests/expectations/enum.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/enum_and_vtable_mangling.rs b/tests/expectations/enum_and_vtable_mangling.rs index f6b1385a..c68dc102 100644 --- a/tests/expectations/enum_and_vtable_mangling.rs +++ b/tests/expectations/enum_and_vtable_mangling.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/enum_dupe.rs b/tests/expectations/enum_dupe.rs index 28d7b63d..10464881 100644 --- a/tests/expectations/enum_dupe.rs +++ b/tests/expectations/enum_dupe.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/enum_explicit_type.rs b/tests/expectations/enum_explicit_type.rs index cfc1f41d..1b94c284 100644 --- a/tests/expectations/enum_explicit_type.rs +++ b/tests/expectations/enum_explicit_type.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/enum_negative.rs b/tests/expectations/enum_negative.rs index 0a7a36f7..03db5709 100644 --- a/tests/expectations/enum_negative.rs +++ b/tests/expectations/enum_negative.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/enum_packed.rs b/tests/expectations/enum_packed.rs index 6b3f1b57..7684a26d 100644 --- a/tests/expectations/enum_packed.rs +++ b/tests/expectations/enum_packed.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/extern.rs b/tests/expectations/extern.rs index eda55446..8f122341 100644 --- a/tests/expectations/extern.rs +++ b/tests/expectations/extern.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/forward_declared_struct.rs b/tests/expectations/forward_declared_struct.rs index 48333da3..3a812c0d 100644 --- a/tests/expectations/forward_declared_struct.rs +++ b/tests/expectations/forward_declared_struct.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/func_proto.rs b/tests/expectations/func_proto.rs index eda55446..8f122341 100644 --- a/tests/expectations/func_proto.rs +++ b/tests/expectations/func_proto.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/func_ptr.rs b/tests/expectations/func_ptr.rs index 4a94aebb..01e413a6 100644 --- a/tests/expectations/func_ptr.rs +++ b/tests/expectations/func_ptr.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/func_ptr_in_struct.rs b/tests/expectations/func_ptr_in_struct.rs index c177116d..3d7b5f68 100644 --- a/tests/expectations/func_ptr_in_struct.rs +++ b/tests/expectations/func_ptr_in_struct.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/func_with_array_arg.rs b/tests/expectations/func_with_array_arg.rs index 4df689ae..1528e0ba 100644 --- a/tests/expectations/func_with_array_arg.rs +++ b/tests/expectations/func_with_array_arg.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/func_with_func_ptr_arg.rs b/tests/expectations/func_with_func_ptr_arg.rs index 1dc98c81..4ac25286 100644 --- a/tests/expectations/func_with_func_ptr_arg.rs +++ b/tests/expectations/func_with_func_ptr_arg.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/inner_template_self.rs b/tests/expectations/inner_template_self.rs index ec8bf6b1..60af23ee 100644 --- a/tests/expectations/inner_template_self.rs +++ b/tests/expectations/inner_template_self.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/jsval_layout_opaque.rs b/tests/expectations/jsval_layout_opaque.rs index 760ac1f2..fa9b89b9 100644 --- a/tests/expectations/jsval_layout_opaque.rs +++ b/tests/expectations/jsval_layout_opaque.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] @@ -167,7 +166,8 @@ impl jsval_layout_jsval_layout_opaque_hpp_unnamed_1 { self._bitfield_1 |= ((val as u64) << 47usize) & (18446603336221196288usize as u64); } - pub const fn new_bitfield_1(payload47: u32, tag: u32) -> u64 { + #[inline] + pub fn new_bitfield_1(payload47: u32, tag: u32) -> u64 { 0 | ((payload47 as u64) << 0u32) | ((tag as u64) << 47u32) } } diff --git a/tests/expectations/mutable.rs b/tests/expectations/mutable.rs index 62b4c524..cf2c5937 100644 --- a/tests/expectations/mutable.rs +++ b/tests/expectations/mutable.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/namespace.rs b/tests/expectations/namespace.rs index 4d9225f3..36113536 100644 --- a/tests/expectations/namespace.rs +++ b/tests/expectations/namespace.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/nested.rs b/tests/expectations/nested.rs index dd61ecdf..2f7fae9a 100644 --- a/tests/expectations/nested.rs +++ b/tests/expectations/nested.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/no_copy.rs b/tests/expectations/no_copy.rs index 95a733b6..601b65c8 100644 --- a/tests/expectations/no_copy.rs +++ b/tests/expectations/no_copy.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/nsStyleAutoArray.rs b/tests/expectations/nsStyleAutoArray.rs index 28207639..8acfa150 100644 --- a/tests/expectations/nsStyleAutoArray.rs +++ b/tests/expectations/nsStyleAutoArray.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/only_bitfields.rs b/tests/expectations/only_bitfields.rs index 88345373..d46a1f83 100644 --- a/tests/expectations/only_bitfields.rs +++ b/tests/expectations/only_bitfields.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] @@ -25,7 +24,8 @@ impl Struct_C { self._bitfield_1 &= !(254usize as u8); self._bitfield_1 |= ((val as u8) << 1usize) & (254usize as u8); } - pub const fn new_bitfield_1(a: bool, b: u8) -> u8 { + #[inline] + pub fn new_bitfield_1(a: bool, b: u8) -> u8 { 0 | ((a as u8) << 0u32) | ((b as u8) << 1u32) } } diff --git a/tests/expectations/opaque_in_struct.rs b/tests/expectations/opaque_in_struct.rs index 24860e2c..a5e3dff6 100644 --- a/tests/expectations/opaque_in_struct.rs +++ b/tests/expectations/opaque_in_struct.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/opaque_pointer.rs b/tests/expectations/opaque_pointer.rs index 7d6961b5..eb5f09cd 100644 --- a/tests/expectations/opaque_pointer.rs +++ b/tests/expectations/opaque_pointer.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/opaque_typedef.rs b/tests/expectations/opaque_typedef.rs index 7dfa0ff9..a54ac881 100644 --- a/tests/expectations/opaque_typedef.rs +++ b/tests/expectations/opaque_typedef.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/overflowed_enum.rs b/tests/expectations/overflowed_enum.rs index 7b6de96b..2228e44b 100644 --- a/tests/expectations/overflowed_enum.rs +++ b/tests/expectations/overflowed_enum.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/size_t_template.rs b/tests/expectations/size_t_template.rs index c4f1b0e5..6f249ae5 100644 --- a/tests/expectations/size_t_template.rs +++ b/tests/expectations/size_t_template.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/struct_containing_forward_declared_struct.rs b/tests/expectations/struct_containing_forward_declared_struct.rs index 8de4c419..11ca55b8 100644 --- a/tests/expectations/struct_containing_forward_declared_struct.rs +++ b/tests/expectations/struct_containing_forward_declared_struct.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/struct_with_anon_struct.rs b/tests/expectations/struct_with_anon_struct.rs index dd6e480a..52495279 100644 --- a/tests/expectations/struct_with_anon_struct.rs +++ b/tests/expectations/struct_with_anon_struct.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/struct_with_anon_struct_array.rs b/tests/expectations/struct_with_anon_struct_array.rs index f0b9290f..19a16cd6 100644 --- a/tests/expectations/struct_with_anon_struct_array.rs +++ b/tests/expectations/struct_with_anon_struct_array.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/struct_with_anon_struct_pointer.rs b/tests/expectations/struct_with_anon_struct_pointer.rs index 97d58aea..84aa0f15 100644 --- a/tests/expectations/struct_with_anon_struct_pointer.rs +++ b/tests/expectations/struct_with_anon_struct_pointer.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/struct_with_anon_union.rs b/tests/expectations/struct_with_anon_union.rs index 668b1273..04883f78 100644 --- a/tests/expectations/struct_with_anon_union.rs +++ b/tests/expectations/struct_with_anon_union.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/struct_with_anon_unnamed_struct.rs b/tests/expectations/struct_with_anon_unnamed_struct.rs index 7318db9a..6f7afeae 100644 --- a/tests/expectations/struct_with_anon_unnamed_struct.rs +++ b/tests/expectations/struct_with_anon_unnamed_struct.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/struct_with_anon_unnamed_union.rs b/tests/expectations/struct_with_anon_unnamed_union.rs index 5df5f61b..73bd0111 100644 --- a/tests/expectations/struct_with_anon_unnamed_union.rs +++ b/tests/expectations/struct_with_anon_unnamed_union.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/struct_with_bitfields.rs b/tests/expectations/struct_with_bitfields.rs index 26003ebd..c2bfc543 100644 --- a/tests/expectations/struct_with_bitfields.rs +++ b/tests/expectations/struct_with_bitfields.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] @@ -80,9 +79,9 @@ impl Struct_bitfield { ((val as ::std::os::raw::c_ushort) << 6usize) & (192usize as ::std::os::raw::c_ushort); } - pub const fn new_bitfield_1(a: bool, b: bool, c: bool, - unnamed_bitfield1: bool, - unnamed_bitfield2: u8, d: u8) + #[inline] + pub fn new_bitfield_1(a: bool, b: bool, c: bool, unnamed_bitfield1: bool, + unnamed_bitfield2: u8, d: u8) -> ::std::os::raw::c_ushort { 0 | ((a as ::std::os::raw::c_ushort) << 0u32) | ((b as ::std::os::raw::c_ushort) << 1u32) | @@ -102,7 +101,8 @@ impl Struct_bitfield { ((val as ::std::os::raw::c_uint) << 0usize) & (3usize as ::std::os::raw::c_uint); } - pub const fn new_bitfield_2(f: u8) -> ::std::os::raw::c_uint { + #[inline] + pub fn new_bitfield_2(f: u8) -> ::std::os::raw::c_uint { 0 | ((f as ::std::os::raw::c_uint) << 0u32) } #[inline] @@ -117,7 +117,8 @@ impl Struct_bitfield { ((val as ::std::os::raw::c_uint) << 0usize) & (4294967295usize as ::std::os::raw::c_uint); } - pub const fn new_bitfield_3(g: u32) -> ::std::os::raw::c_uint { + #[inline] + pub fn new_bitfield_3(g: u32) -> ::std::os::raw::c_uint { 0 | ((g as ::std::os::raw::c_uint) << 0u32) } } diff --git a/tests/expectations/struct_with_derive_debug.rs b/tests/expectations/struct_with_derive_debug.rs index bc006717..f89d9d72 100644 --- a/tests/expectations/struct_with_derive_debug.rs +++ b/tests/expectations/struct_with_derive_debug.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/struct_with_nesting.rs b/tests/expectations/struct_with_nesting.rs index 787a174d..2de481ea 100644 --- a/tests/expectations/struct_with_nesting.rs +++ b/tests/expectations/struct_with_nesting.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/struct_with_packing.rs b/tests/expectations/struct_with_packing.rs index a6aa9780..9f997435 100644 --- a/tests/expectations/struct_with_packing.rs +++ b/tests/expectations/struct_with_packing.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/struct_with_struct.rs b/tests/expectations/struct_with_struct.rs index 234cd6f5..0c6ab122 100644 --- a/tests/expectations/struct_with_struct.rs +++ b/tests/expectations/struct_with_struct.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/template.rs b/tests/expectations/template.rs index 02e683a8..2f3f9a21 100644 --- a/tests/expectations/template.rs +++ b/tests/expectations/template.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/union_fields.rs b/tests/expectations/union_fields.rs index 974a8f71..1a957eaa 100644 --- a/tests/expectations/union_fields.rs +++ b/tests/expectations/union_fields.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/union_with_anon_struct.rs b/tests/expectations/union_with_anon_struct.rs index 3f78fb85..850f39bc 100644 --- a/tests/expectations/union_with_anon_struct.rs +++ b/tests/expectations/union_with_anon_struct.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/union_with_anon_struct_bitfield.rs b/tests/expectations/union_with_anon_struct_bitfield.rs index 26b428f5..ce59836e 100644 --- a/tests/expectations/union_with_anon_struct_bitfield.rs +++ b/tests/expectations/union_with_anon_struct_bitfield.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] @@ -79,7 +78,8 @@ impl Struct_foo_union_with_anon_struct_bitfield_h_unnamed_1 { ((val as ::std::os::raw::c_int) << 7usize) & (4294967168usize as ::std::os::raw::c_int); } - pub const fn new_bitfield_1(b: u8, c: u32) -> ::std::os::raw::c_int { + #[inline] + pub fn new_bitfield_1(b: u8, c: u32) -> ::std::os::raw::c_int { 0 | ((b as ::std::os::raw::c_int) << 0u32) | ((c as ::std::os::raw::c_int) << 7u32) } diff --git a/tests/expectations/union_with_anon_union.rs b/tests/expectations/union_with_anon_union.rs index 9ea9b841..f610342d 100644 --- a/tests/expectations/union_with_anon_union.rs +++ b/tests/expectations/union_with_anon_union.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/union_with_anon_unnamed_struct.rs b/tests/expectations/union_with_anon_unnamed_struct.rs index 80e28512..cdc760c4 100644 --- a/tests/expectations/union_with_anon_unnamed_struct.rs +++ b/tests/expectations/union_with_anon_unnamed_struct.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/union_with_anon_unnamed_union.rs b/tests/expectations/union_with_anon_unnamed_union.rs index a502f1f3..50dfc8d0 100644 --- a/tests/expectations/union_with_anon_unnamed_union.rs +++ b/tests/expectations/union_with_anon_unnamed_union.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/union_with_big_member.rs b/tests/expectations/union_with_big_member.rs index 122d5a64..d1cd63d4 100644 --- a/tests/expectations/union_with_big_member.rs +++ b/tests/expectations/union_with_big_member.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/union_with_nesting.rs b/tests/expectations/union_with_nesting.rs index 070cc045..4117786d 100644 --- a/tests/expectations/union_with_nesting.rs +++ b/tests/expectations/union_with_nesting.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/using.rs b/tests/expectations/using.rs index 705c4bd5..adc1e61b 100644 --- a/tests/expectations/using.rs +++ b/tests/expectations/using.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] diff --git a/tests/expectations/weird_bitfields.rs b/tests/expectations/weird_bitfields.rs index d2ae1f96..6166a60f 100644 --- a/tests/expectations/weird_bitfields.rs +++ b/tests/expectations/weird_bitfields.rs @@ -1,7 +1,6 @@ /* automatically generated by rust-bindgen */ -#![feature(const_fn)] #![allow(non_snake_case)] @@ -54,7 +53,8 @@ impl Struct_Weird { ((val as ::std::os::raw::c_uint) << 16usize) & (2147418112usize as ::std::os::raw::c_uint); } - pub const fn new_bitfield_1(bitTest: u16, bitTest2: u16) + #[inline] + pub fn new_bitfield_1(bitTest: u16, bitTest2: u16) -> ::std::os::raw::c_uint { 0 | ((bitTest as ::std::os::raw::c_uint) << 0u32) | ((bitTest2 as ::std::os::raw::c_uint) << 16u32) @@ -104,11 +104,11 @@ impl Struct_Weird { self._bitfield_2 &= !(256usize as u32); self._bitfield_2 |= ((val as u32) << 8usize) & (256usize as u32); } - pub const fn new_bitfield_2(mFillOpacitySource: u8, - mStrokeOpacitySource: u8, - mStrokeDasharrayFromObject: bool, - mStrokeDashoffsetFromObject: bool, - mStrokeWidthFromObject: bool) -> u32 { + #[inline] + pub fn new_bitfield_2(mFillOpacitySource: u8, mStrokeOpacitySource: u8, + mStrokeDasharrayFromObject: bool, + mStrokeDashoffsetFromObject: bool, + mStrokeWidthFromObject: bool) -> u32 { 0 | ((mFillOpacitySource as u32) << 0u32) | ((mStrokeOpacitySource as u32) << 3u32) | ((mStrokeDasharrayFromObject as u32) << 6u32) | diff --git a/tests/headers/jsval_layout_opaque.hpp b/tests/headers/jsval_layout_opaque.hpp index 630a2c17..db09cb54 100644 --- a/tests/headers/jsval_layout_opaque.hpp +++ b/tests/headers/jsval_layout_opaque.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: -std=c++11 -match jsval_layout_opaque.hpp -no-type-renaming +// bindgen-flags: -std=c++11 -match jsval_layout_opaque.hpp -no-type-renaming -no-unstable-rust #include <stdint.h> #include <stddef.h> diff --git a/tests/headers/only_bitfields.hpp b/tests/headers/only_bitfields.hpp index 48b401b6..30a75ebb 100644 --- a/tests/headers/only_bitfields.hpp +++ b/tests/headers/only_bitfields.hpp @@ -1,4 +1,4 @@ - +// bindgen-flags: -no-unstable-rust class C { bool a: 1; bool b: 7; diff --git a/tests/headers/struct_with_bitfields.h b/tests/headers/struct_with_bitfields.h index ece512cd..b994da4e 100644 --- a/tests/headers/struct_with_bitfields.h +++ b/tests/headers/struct_with_bitfields.h @@ -1,3 +1,4 @@ +// bindgen-flags: -no-unstable-rust struct bitfield { unsigned short a :1, diff --git a/tests/headers/union_with_anon_struct_bitfield.h b/tests/headers/union_with_anon_struct_bitfield.h index d39b92d1..5a6fc7bc 100644 --- a/tests/headers/union_with_anon_struct_bitfield.h +++ b/tests/headers/union_with_anon_struct_bitfield.h @@ -1,7 +1,8 @@ +// bindgen-flags: -no-unstable-rust union foo { int a; struct { int b : 7; int c : 25; }; -};
\ No newline at end of file +}; diff --git a/tests/headers/weird_bitfields.hpp b/tests/headers/weird_bitfields.hpp index 68cbf4a5..e8287507 100644 --- a/tests/headers/weird_bitfields.hpp +++ b/tests/headers/weird_bitfields.hpp @@ -1,3 +1,4 @@ +// bindgen-flags: -no-unstable-rust // You can guess where this is taken from... enum nsStyleSVGOpacitySource { eStyleSVGOpacitySource_Normal, diff --git a/tests/tools/run-bindgen.py b/tests/tools/run-bindgen.py index 5fde6739..50e96d95 100755 --- a/tests/tools/run-bindgen.py +++ b/tests/tools/run-bindgen.py @@ -7,7 +7,6 @@ import tempfile BINDGEN_FLAGS_PREFIX = "// bindgen-flags: "; COMMON_PRELUDE = """ -#![feature(const_fn)] #![allow(non_snake_case)] """ |