Skip to content

Commit

Permalink
Remove deprecated methods (#2346)
Browse files Browse the repository at this point in the history
  • Loading branch information
pvdrz committed Nov 17, 2022
1 parent ce534c1 commit 8fe2308
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 168 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bindgen-cli/Cargo.toml
Expand Up @@ -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"
Expand Down
23 changes: 1 addition & 22 deletions bindgen-cli/options.rs
Expand Up @@ -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;

Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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.")
Expand Down Expand Up @@ -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 \
Expand All @@ -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.",
Expand All @@ -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 \
Expand Down Expand Up @@ -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)?);
}
Expand Down
39 changes: 0 additions & 39 deletions bindgen-tests/tests/expectations/tests/whitelist-alternates.rs

This file was deleted.

8 changes: 0 additions & 8 deletions bindgen-tests/tests/headers/whitelist-alternates.h

This file was deleted.

2 changes: 1 addition & 1 deletion bindgen/Cargo.toml
Expand Up @@ -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
Expand Down
95 changes: 0 additions & 95 deletions bindgen/lib.rs
Expand Up @@ -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 {
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 8fe2308

Please sign in to comment.