summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs59
1 files changed, 12 insertions, 47 deletions
diff --git a/src/lib.rs b/src/lib.rs
index feb3c309..3a853829 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -62,7 +62,6 @@ macro_rules! doc_mod {
}
mod clang;
-mod features;
mod ir;
mod parse;
mod regex_set;
@@ -73,7 +72,6 @@ pub mod callbacks;
mod codegen;
doc_mod!(clang, clang_docs);
-doc_mod!(features, features_docs);
doc_mod!(ir, ir_docs);
doc_mod!(parse, parse_docs);
doc_mod!(regex_set, regex_set_docs);
@@ -82,8 +80,6 @@ mod codegen {
include!(concat!(env!("OUT_DIR"), "/codegen.rs"));
}
-pub use features::{RustTarget, LATEST_STABLE_RUST, RUST_TARGET_STRINGS};
-use features::RustFeatures;
use ir::context::{BindgenContext, ItemId};
use ir::item::Item;
use parse::{ClangItemParser, ParseError};
@@ -192,8 +188,6 @@ impl Builder {
output_vector.push(header);
}
- output_vector.push(self.options.rust_target.into());
-
self.options
.bitfield_enums
.get_items()
@@ -346,6 +340,10 @@ impl Builder {
output_vector.push("--no-prepend-enum-name".into());
}
+ if !self.options.unstable_rust {
+ output_vector.push("--unstable-rust".into());
+ }
+
self.options
.opaque_types
.get_items()
@@ -465,14 +463,6 @@ impl Builder {
self
}
- /// Specify the rust target
- ///
- /// The default is the latest stable Rust version
- pub fn rust_target(mut self, rust_target: RustTarget) -> Self {
- self.options.set_rust_target(rust_target);
- self
- }
-
/// Set the output graphviz file.
pub fn emit_ir_graphviz<T: Into<String>>(mut self, path: T) -> Builder {
let path = path.into();
@@ -754,10 +744,9 @@ impl Builder {
}
/// Avoid generating any unstable Rust, such as Rust unions, in the generated bindings.
- #[deprecated(note="please use `rust_target` instead")]
- pub fn unstable_rust(self, doit: bool) -> Self {
- let rust_target = if doit { RustTarget::Nightly } else { LATEST_STABLE_RUST };
- self.rust_target(rust_target)
+ pub fn unstable_rust(mut self, doit: bool) -> Self {
+ self.options.unstable_rust = doit;
+ self
}
/// Use core instead of libstd in the generated bindings.
@@ -966,6 +955,10 @@ pub struct BindgenOptions {
/// and types.
pub derive_default: bool,
+ /// True if we can use unstable Rust code in the bindings, false if we
+ /// cannot.
+ pub unstable_rust: bool,
+
/// True if we should avoid using libstd to use libcore instead.
pub use_core: bool,
@@ -1032,12 +1025,6 @@ pub struct BindgenOptions {
/// Whether to prepend the enum name to bitfield or constant variants.
pub prepend_enum_name: bool,
-
- /// Version of the Rust compiler to target
- rust_target: RustTarget,
-
- /// Features to enable, derived from `rust_target`
- rust_features: RustFeatures,
}
/// TODO(emilio): This is sort of a lie (see the error message that results from
@@ -1056,34 +1043,11 @@ impl BindgenOptions {
self.constified_enum_modules.build();
self.constified_enums.build();
}
-
- /// Update rust target version
- pub fn set_rust_target(&mut self, rust_target: RustTarget) {
- self.rust_target = rust_target;
-
- // Keep rust_features synced with rust_target
- self.rust_features = rust_target.into();
- }
-
- /// Get target Rust version
- pub fn rust_target(&self) -> RustTarget {
- self.rust_target
- }
-
- /// Get features supported by target Rust version
- pub fn rust_features(&self) -> RustFeatures {
- self.rust_features
- }
-
}
impl Default for BindgenOptions {
fn default() -> BindgenOptions {
- let rust_target = RustTarget::default();
-
BindgenOptions {
- rust_target: rust_target,
- rust_features: rust_target.into(),
hidden_types: Default::default(),
opaque_types: Default::default(),
whitelisted_types: Default::default(),
@@ -1102,6 +1066,7 @@ impl Default for BindgenOptions {
derive_default: false,
enable_cxx_namespaces: false,
disable_name_namespacing: false,
+ unstable_rust: false,
use_core: false,
ctypes_prefix: None,
namespaced_constants: true,