diff --git a/CHANGELOG.md b/CHANGELOG.md index d1c8ffb9..237e3801 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -157,6 +157,12 @@ ## Removed + * The following deprecated methods and their equivalent CLI arguments were + removed: `whitelist_recursively`, `hide_type`, `blacklist_type`, + `blacklist_function`, `blacklist_item`, `whitelisted_type`, + `whitelist_type`, `whitelist_function`, `whitelisted_function`, + `whitelist_var`, `whitelisted_var`, `unstable_rust`. + ## Fixed ## Security diff --git a/Cargo.lock b/Cargo.lock index d656f9dd..ff13ebcb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -48,7 +48,7 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "bindgen" -version = "0.62.0" +version = "0.63.0" dependencies = [ "bitflags", "cexpr", @@ -68,7 +68,7 @@ dependencies = [ [[package]] name = "bindgen-cli" -version = "0.62.0" +version = "0.63.0" dependencies = [ "bindgen", "clap 3.2.12", diff --git a/bindgen-cli/Cargo.toml b/bindgen-cli/Cargo.toml index 7bff8f46..b2b56a94 100644 --- a/bindgen-cli/Cargo.toml +++ b/bindgen-cli/Cargo.toml @@ -11,7 +11,7 @@ readme = "../README.md" repository = "https://github.com/rust-lang/rust-bindgen" documentation = "https://docs.rs/bindgen" homepage = "https://rust-lang.github.io/rust-bindgen/" -version = "0.62.0" +version = "0.63.0" edition = "2018" # If you change this, also update README.md and msrv in .github/workflows/bindgen.yml rust-version = "1.57.0" diff --git a/bindgen-cli/options.rs b/bindgen-cli/options.rs index 482f9a7d..426e5cf7 100644 --- a/bindgen-cli/options.rs +++ b/bindgen-cli/options.rs @@ -5,7 +5,7 @@ use bindgen::{ }; use clap::{App, Arg}; use std::fs::File; -use std::io::{self, stderr, Error, ErrorKind, Write}; +use std::io::{self, Error, ErrorKind}; use std::path::PathBuf; use std::str::FromStr; @@ -175,28 +175,24 @@ where .multiple_occurrences(true) .number_of_values(1), Arg::new("blocklist-type") - .alias("blacklist-type") .long("blocklist-type") .help("Mark as hidden.") .value_name("type") .multiple_occurrences(true) .number_of_values(1), Arg::new("blocklist-function") - .alias("blacklist-function") .long("blocklist-function") .help("Mark as hidden.") .value_name("function") .multiple_occurrences(true) .number_of_values(1), Arg::new("blocklist-item") - .alias("blacklist-item") .long("blocklist-item") .help("Mark as hidden.") .value_name("item") .multiple_occurrences(true) .number_of_values(1), Arg::new("blocklist-file") - .alias("blacklist-file") .long("blocklist-file") .help("Mark all contents of as hidden.") .value_name("path") @@ -257,7 +253,6 @@ where ), Arg::new("no-recursive-allowlist") .long("no-recursive-allowlist") - .alias("no-recursive-whitelist") .help( "Disable allowlisting types recursively. This will cause \ bindgen to emit Rust code that won't compile! See the \ @@ -362,10 +357,6 @@ where Arg::new("fit-macro-constant-types") .long("fit-macro-constant-types") .help("Try to fit macro constants into types smaller than u32/i32"), - Arg::new("unstable-rust") - .long("unstable-rust") - .help("Generate unstable Rust code (deprecated; use --rust-target instead).") - .multiple_occurrences(true), // FIXME: Pass legacy test suite Arg::new("opaque-type") .long("opaque-type") .help("Mark as opaque.") @@ -406,7 +397,6 @@ where .help("MSVC C++ ABI mangling. DEPRECATED: Has no effect."), Arg::new("allowlist-function") .long("allowlist-function") - .alias("whitelist-function") .help( "Allowlist all the free-standing functions matching \ . Other non-allowlisted functions will not be \ @@ -420,7 +410,6 @@ where .help("Generate inline functions."), Arg::new("allowlist-type") .long("allowlist-type") - .alias("whitelist-type") .help( "Only generate types matching . Other non-allowlisted types will \ not be generated.", @@ -430,7 +419,6 @@ where .number_of_values(1), Arg::new("allowlist-var") .long("allowlist-var") - .alias("whitelist-var") .help( "Allowlist all the free-standing variables matching \ . Other non-allowlisted variables will not be \ @@ -600,15 +588,6 @@ where return Err(Error::new(ErrorKind::Other, "Header not found")); } - if matches.is_present("unstable-rust") { - builder = builder.rust_target(RustTarget::Nightly); - writeln!( - &mut stderr(), - "warning: the `--unstable-rust` option is deprecated" - ) - .expect("Unable to write error message"); - } - if let Some(rust_target) = matches.value_of("rust-target") { builder = builder.rust_target(RustTarget::from_str(rust_target)?); } diff --git a/bindgen-tests/tests/expectations/tests/whitelist-alternates.rs b/bindgen-tests/tests/expectations/tests/whitelist-alternates.rs deleted file mode 100644 index 77d963d8..00000000 --- a/bindgen-tests/tests/expectations/tests/whitelist-alternates.rs +++ /dev/null @@ -1,39 +0,0 @@ -#![allow( - dead_code, - non_snake_case, - non_camel_case_types, - non_upper_case_globals -)] - -#[repr(C)] -#[derive(Debug, Default, Copy, Clone)] -pub struct WhitelistedType {} -#[test] -fn bindgen_test_layout_WhitelistedType() { - assert_eq!( - ::std::mem::size_of::(), - 0usize, - concat!("Size of: ", stringify!(WhitelistedType)) - ); - assert_eq!( - ::std::mem::align_of::(), - 1usize, - concat!("Alignment of ", stringify!(WhitelistedType)) - ); -} -#[repr(C)] -#[derive(Debug, Default, Copy, Clone)] -pub struct AllowType {} -#[test] -fn bindgen_test_layout_AllowType() { - assert_eq!( - ::std::mem::size_of::(), - 0usize, - concat!("Size of: ", stringify!(AllowType)) - ); - assert_eq!( - ::std::mem::align_of::(), - 1usize, - concat!("Alignment of ", stringify!(AllowType)) - ); -} diff --git a/bindgen-tests/tests/headers/whitelist-alternates.h b/bindgen-tests/tests/headers/whitelist-alternates.h deleted file mode 100644 index 7aa3bf87..00000000 --- a/bindgen-tests/tests/headers/whitelist-alternates.h +++ /dev/null @@ -1,8 +0,0 @@ -// bindgen-flags: --whitelist-type 'Whitelisted.*|Allow.*' -// Test for changes introduced in #1756 - -struct WhitelistedType {}; -struct AllowType {}; -// this would have been accepted because the start anchor -// wouldn't be applied to the second alternative: -struct NoAllowType {}; diff --git a/bindgen/Cargo.toml b/bindgen/Cargo.toml index 13e5f445..65222095 100644 --- a/bindgen/Cargo.toml +++ b/bindgen/Cargo.toml @@ -14,7 +14,7 @@ readme = "../README.md" repository = "https://github.com/rust-lang/rust-bindgen" documentation = "https://docs.rs/bindgen" homepage = "https://rust-lang.github.io/rust-bindgen/" -version = "0.62.0" +version = "0.63.0" edition = "2018" build = "build.rs" # If you change this, also update README.md and msrv in .github/workflows/bindgen.yml diff --git a/bindgen/lib.rs b/bindgen/lib.rs index e18a2a99..bfc22bb6 100644 --- a/bindgen/lib.rs +++ b/bindgen/lib.rs @@ -796,12 +796,6 @@ impl Builder { self } - /// Deprecated alias for allowlist_recursively. - #[deprecated(note = "Use allowlist_recursively instead")] - pub fn whitelist_recursively(self, doit: bool) -> Self { - self.allowlist_recursively(doit) - } - /// Generate `#[macro_use] extern crate objc;` instead of `use objc;` /// in the prologue of the files generated from objective-c files pub fn objc_extern_crate(mut self, doit: bool) -> Self { @@ -834,20 +828,6 @@ impl Builder { self } - /// Hide the given type from the generated bindings. Regular expressions are - /// supported. - #[deprecated(note = "Use blocklist_type instead")] - pub fn hide_type>(self, arg: T) -> Builder { - self.blocklist_type(arg) - } - - /// Hide the given type from the generated bindings. Regular expressions are - /// supported. - #[deprecated(note = "Use blocklist_type instead")] - pub fn blacklist_type>(self, arg: T) -> Builder { - self.blocklist_type(arg) - } - fn_with_regex_arg! { /// Hide the given type from the generated bindings. Regular expressions are /// supported. @@ -859,15 +839,6 @@ impl Builder { } } - fn_with_regex_arg! { - /// Hide the given function from the generated bindings. Regular expressions - /// are supported. - #[deprecated(note = "Use blocklist_function instead")] - pub fn blacklist_function>(self, arg: T) -> Builder { - self.blocklist_function(arg) - } - } - fn_with_regex_arg! { /// Hide the given function from the generated bindings. Regular expressions /// are supported. @@ -883,15 +854,6 @@ impl Builder { } } - /// Hide the given item from the generated bindings, regardless of - /// whether it's a type, function, module, etc. Regular - /// expressions are supported. - #[deprecated(note = "Use blocklist_item instead")] - pub fn blacklist_item>(mut self, arg: T) -> Builder { - self.options.blocklisted_items.insert(arg); - self - } - fn_with_regex_arg! { /// Hide the given item from the generated bindings, regardless of /// whether it's a type, function, module, etc. Regular @@ -924,22 +886,6 @@ impl Builder { } } - /// Allowlist the given type so that it (and all types that it transitively - /// refers to) appears in the generated bindings. Regular expressions are - /// supported. - #[deprecated(note = "use allowlist_type instead")] - pub fn whitelisted_type>(self, arg: T) -> Builder { - self.allowlist_type(arg) - } - - /// Allowlist the given type so that it (and all types that it transitively - /// refers to) appears in the generated bindings. Regular expressions are - /// supported. - #[deprecated(note = "use allowlist_type instead")] - pub fn whitelist_type>(self, arg: T) -> Builder { - self.allowlist_type(arg) - } - fn_with_regex_arg! { /// Allowlist the given type so that it (and all types that it transitively /// refers to) appears in the generated bindings. Regular expressions are @@ -968,22 +914,6 @@ impl Builder { } } - /// Allowlist the given function. - /// - /// Deprecated: use allowlist_function instead. - #[deprecated(note = "use allowlist_function instead")] - pub fn whitelist_function>(self, arg: T) -> Builder { - self.allowlist_function(arg) - } - - /// Allowlist the given function. - /// - /// Deprecated: use allowlist_function instead. - #[deprecated(note = "use allowlist_function instead")] - pub fn whitelisted_function>(self, arg: T) -> Builder { - self.allowlist_function(arg) - } - fn_with_regex_arg! { /// Allowlist the given variable so that it (and all types that it /// transitively refers to) appears in the generated bindings. Regular @@ -1004,20 +934,6 @@ impl Builder { } } - /// Deprecated: use allowlist_var instead. - #[deprecated(note = "use allowlist_var instead")] - pub fn whitelist_var>(self, arg: T) -> Builder { - self.allowlist_var(arg) - } - - /// Allowlist the given variable. - /// - /// Deprecated: use allowlist_var instead. - #[deprecated(note = "use allowlist_var instead")] - pub fn whitelisted_var>(self, arg: T) -> Builder { - self.allowlist_var(arg) - } - /// Set the default style of code to generate for enums pub fn default_enum_style( mut self, @@ -1496,17 +1412,6 @@ impl Builder { self } - /// 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) - } - /// Use core instead of libstd in the generated bindings. pub fn use_core(mut self) -> Builder { self.options.use_core = true;