Remove deprecated methods (#2346)

This commit is contained in:
Christian Poveda Ruiz 2022-11-17 10:02:29 -05:00 committed by GitHub
parent ce534c1a13
commit 8fe230830f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 11 additions and 168 deletions

View File

@ -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

4
Cargo.lock generated
View File

@ -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",

View File

@ -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"

View File

@ -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 <type> as hidden.")
.value_name("type")
.multiple_occurrences(true)
.number_of_values(1),
Arg::new("blocklist-function")
.alias("blacklist-function")
.long("blocklist-function")
.help("Mark <function> as hidden.")
.value_name("function")
.multiple_occurrences(true)
.number_of_values(1),
Arg::new("blocklist-item")
.alias("blacklist-item")
.long("blocklist-item")
.help("Mark <item> 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 <path> 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 <type> 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 \
<regex>. 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 <regex>. 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 \
<regex>. 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)?);
}

View File

@ -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::<WhitelistedType>(),
0usize,
concat!("Size of: ", stringify!(WhitelistedType))
);
assert_eq!(
::std::mem::align_of::<WhitelistedType>(),
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::<AllowType>(),
0usize,
concat!("Size of: ", stringify!(AllowType))
);
assert_eq!(
::std::mem::align_of::<AllowType>(),
1usize,
concat!("Alignment of ", stringify!(AllowType))
);
}

View File

@ -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 {};

View File

@ -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

View File

@ -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<T: AsRef<str>>(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<T: AsRef<str>>(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<T: AsRef<str>>(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<T: AsRef<str>>(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<T: AsRef<str>>(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<T: AsRef<str>>(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<T: AsRef<str>>(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<T: AsRef<str>>(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<T: AsRef<str>>(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<T: AsRef<str>>(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;