Skip to content

Commit 8fe2308

Browse files
authored
Remove deprecated methods (#2346)
1 parent ce534c1 commit 8fe2308

File tree

8 files changed

+11
-168
lines changed

8 files changed

+11
-168
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,12 @@
157157

158158
## Removed
159159

160+
* The following deprecated methods and their equivalent CLI arguments were
161+
removed: `whitelist_recursively`, `hide_type`, `blacklist_type`,
162+
`blacklist_function`, `blacklist_item`, `whitelisted_type`,
163+
`whitelist_type`, `whitelist_function`, `whitelisted_function`,
164+
`whitelist_var`, `whitelisted_var`, `unstable_rust`.
165+
160166
## Fixed
161167

162168
## Security

Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-cli/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ readme = "../README.md"
1111
repository = "https://github.com/rust-lang/rust-bindgen"
1212
documentation = "https://docs.rs/bindgen"
1313
homepage = "https://rust-lang.github.io/rust-bindgen/"
14-
version = "0.62.0"
14+
version = "0.63.0"
1515
edition = "2018"
1616
# If you change this, also update README.md and msrv in .github/workflows/bindgen.yml
1717
rust-version = "1.57.0"

bindgen-cli/options.rs

+1-22
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use bindgen::{
55
};
66
use clap::{App, Arg};
77
use std::fs::File;
8-
use std::io::{self, stderr, Error, ErrorKind, Write};
8+
use std::io::{self, Error, ErrorKind};
99
use std::path::PathBuf;
1010
use std::str::FromStr;
1111

@@ -175,28 +175,24 @@ where
175175
.multiple_occurrences(true)
176176
.number_of_values(1),
177177
Arg::new("blocklist-type")
178-
.alias("blacklist-type")
179178
.long("blocklist-type")
180179
.help("Mark <type> as hidden.")
181180
.value_name("type")
182181
.multiple_occurrences(true)
183182
.number_of_values(1),
184183
Arg::new("blocklist-function")
185-
.alias("blacklist-function")
186184
.long("blocklist-function")
187185
.help("Mark <function> as hidden.")
188186
.value_name("function")
189187
.multiple_occurrences(true)
190188
.number_of_values(1),
191189
Arg::new("blocklist-item")
192-
.alias("blacklist-item")
193190
.long("blocklist-item")
194191
.help("Mark <item> as hidden.")
195192
.value_name("item")
196193
.multiple_occurrences(true)
197194
.number_of_values(1),
198195
Arg::new("blocklist-file")
199-
.alias("blacklist-file")
200196
.long("blocklist-file")
201197
.help("Mark all contents of <path> as hidden.")
202198
.value_name("path")
@@ -257,7 +253,6 @@ where
257253
),
258254
Arg::new("no-recursive-allowlist")
259255
.long("no-recursive-allowlist")
260-
.alias("no-recursive-whitelist")
261256
.help(
262257
"Disable allowlisting types recursively. This will cause \
263258
bindgen to emit Rust code that won't compile! See the \
@@ -362,10 +357,6 @@ where
362357
Arg::new("fit-macro-constant-types")
363358
.long("fit-macro-constant-types")
364359
.help("Try to fit macro constants into types smaller than u32/i32"),
365-
Arg::new("unstable-rust")
366-
.long("unstable-rust")
367-
.help("Generate unstable Rust code (deprecated; use --rust-target instead).")
368-
.multiple_occurrences(true), // FIXME: Pass legacy test suite
369360
Arg::new("opaque-type")
370361
.long("opaque-type")
371362
.help("Mark <type> as opaque.")
@@ -406,7 +397,6 @@ where
406397
.help("MSVC C++ ABI mangling. DEPRECATED: Has no effect."),
407398
Arg::new("allowlist-function")
408399
.long("allowlist-function")
409-
.alias("whitelist-function")
410400
.help(
411401
"Allowlist all the free-standing functions matching \
412402
<regex>. Other non-allowlisted functions will not be \
@@ -420,7 +410,6 @@ where
420410
.help("Generate inline functions."),
421411
Arg::new("allowlist-type")
422412
.long("allowlist-type")
423-
.alias("whitelist-type")
424413
.help(
425414
"Only generate types matching <regex>. Other non-allowlisted types will \
426415
not be generated.",
@@ -430,7 +419,6 @@ where
430419
.number_of_values(1),
431420
Arg::new("allowlist-var")
432421
.long("allowlist-var")
433-
.alias("whitelist-var")
434422
.help(
435423
"Allowlist all the free-standing variables matching \
436424
<regex>. Other non-allowlisted variables will not be \
@@ -600,15 +588,6 @@ where
600588
return Err(Error::new(ErrorKind::Other, "Header not found"));
601589
}
602590

603-
if matches.is_present("unstable-rust") {
604-
builder = builder.rust_target(RustTarget::Nightly);
605-
writeln!(
606-
&mut stderr(),
607-
"warning: the `--unstable-rust` option is deprecated"
608-
)
609-
.expect("Unable to write error message");
610-
}
611-
612591
if let Some(rust_target) = matches.value_of("rust-target") {
613592
builder = builder.rust_target(RustTarget::from_str(rust_target)?);
614593
}

bindgen-tests/tests/expectations/tests/whitelist-alternates.rs

-39
This file was deleted.

bindgen-tests/tests/headers/whitelist-alternates.h

-8
This file was deleted.

bindgen/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ readme = "../README.md"
1414
repository = "https://github.com/rust-lang/rust-bindgen"
1515
documentation = "https://docs.rs/bindgen"
1616
homepage = "https://rust-lang.github.io/rust-bindgen/"
17-
version = "0.62.0"
17+
version = "0.63.0"
1818
edition = "2018"
1919
build = "build.rs"
2020
# If you change this, also update README.md and msrv in .github/workflows/bindgen.yml

bindgen/lib.rs

-95
Original file line numberDiff line numberDiff line change
@@ -796,12 +796,6 @@ impl Builder {
796796
self
797797
}
798798

799-
/// Deprecated alias for allowlist_recursively.
800-
#[deprecated(note = "Use allowlist_recursively instead")]
801-
pub fn whitelist_recursively(self, doit: bool) -> Self {
802-
self.allowlist_recursively(doit)
803-
}
804-
805799
/// Generate `#[macro_use] extern crate objc;` instead of `use objc;`
806800
/// in the prologue of the files generated from objective-c files
807801
pub fn objc_extern_crate(mut self, doit: bool) -> Self {
@@ -834,20 +828,6 @@ impl Builder {
834828
self
835829
}
836830

837-
/// Hide the given type from the generated bindings. Regular expressions are
838-
/// supported.
839-
#[deprecated(note = "Use blocklist_type instead")]
840-
pub fn hide_type<T: AsRef<str>>(self, arg: T) -> Builder {
841-
self.blocklist_type(arg)
842-
}
843-
844-
/// Hide the given type from the generated bindings. Regular expressions are
845-
/// supported.
846-
#[deprecated(note = "Use blocklist_type instead")]
847-
pub fn blacklist_type<T: AsRef<str>>(self, arg: T) -> Builder {
848-
self.blocklist_type(arg)
849-
}
850-
851831
fn_with_regex_arg! {
852832
/// Hide the given type from the generated bindings. Regular expressions are
853833
/// supported.
@@ -859,15 +839,6 @@ impl Builder {
859839
}
860840
}
861841

862-
fn_with_regex_arg! {
863-
/// Hide the given function from the generated bindings. Regular expressions
864-
/// are supported.
865-
#[deprecated(note = "Use blocklist_function instead")]
866-
pub fn blacklist_function<T: AsRef<str>>(self, arg: T) -> Builder {
867-
self.blocklist_function(arg)
868-
}
869-
}
870-
871842
fn_with_regex_arg! {
872843
/// Hide the given function from the generated bindings. Regular expressions
873844
/// are supported.
@@ -883,15 +854,6 @@ impl Builder {
883854
}
884855
}
885856

886-
/// Hide the given item from the generated bindings, regardless of
887-
/// whether it's a type, function, module, etc. Regular
888-
/// expressions are supported.
889-
#[deprecated(note = "Use blocklist_item instead")]
890-
pub fn blacklist_item<T: AsRef<str>>(mut self, arg: T) -> Builder {
891-
self.options.blocklisted_items.insert(arg);
892-
self
893-
}
894-
895857
fn_with_regex_arg! {
896858
/// Hide the given item from the generated bindings, regardless of
897859
/// whether it's a type, function, module, etc. Regular
@@ -924,22 +886,6 @@ impl Builder {
924886
}
925887
}
926888

927-
/// Allowlist the given type so that it (and all types that it transitively
928-
/// refers to) appears in the generated bindings. Regular expressions are
929-
/// supported.
930-
#[deprecated(note = "use allowlist_type instead")]
931-
pub fn whitelisted_type<T: AsRef<str>>(self, arg: T) -> Builder {
932-
self.allowlist_type(arg)
933-
}
934-
935-
/// Allowlist the given type so that it (and all types that it transitively
936-
/// refers to) appears in the generated bindings. Regular expressions are
937-
/// supported.
938-
#[deprecated(note = "use allowlist_type instead")]
939-
pub fn whitelist_type<T: AsRef<str>>(self, arg: T) -> Builder {
940-
self.allowlist_type(arg)
941-
}
942-
943889
fn_with_regex_arg! {
944890
/// Allowlist the given type so that it (and all types that it transitively
945891
/// refers to) appears in the generated bindings. Regular expressions are
@@ -968,22 +914,6 @@ impl Builder {
968914
}
969915
}
970916

971-
/// Allowlist the given function.
972-
///
973-
/// Deprecated: use allowlist_function instead.
974-
#[deprecated(note = "use allowlist_function instead")]
975-
pub fn whitelist_function<T: AsRef<str>>(self, arg: T) -> Builder {
976-
self.allowlist_function(arg)
977-
}
978-
979-
/// Allowlist the given function.
980-
///
981-
/// Deprecated: use allowlist_function instead.
982-
#[deprecated(note = "use allowlist_function instead")]
983-
pub fn whitelisted_function<T: AsRef<str>>(self, arg: T) -> Builder {
984-
self.allowlist_function(arg)
985-
}
986-
987917
fn_with_regex_arg! {
988918
/// Allowlist the given variable so that it (and all types that it
989919
/// transitively refers to) appears in the generated bindings. Regular
@@ -1004,20 +934,6 @@ impl Builder {
1004934
}
1005935
}
1006936

1007-
/// Deprecated: use allowlist_var instead.
1008-
#[deprecated(note = "use allowlist_var instead")]
1009-
pub fn whitelist_var<T: AsRef<str>>(self, arg: T) -> Builder {
1010-
self.allowlist_var(arg)
1011-
}
1012-
1013-
/// Allowlist the given variable.
1014-
///
1015-
/// Deprecated: use allowlist_var instead.
1016-
#[deprecated(note = "use allowlist_var instead")]
1017-
pub fn whitelisted_var<T: AsRef<str>>(self, arg: T) -> Builder {
1018-
self.allowlist_var(arg)
1019-
}
1020-
1021937
/// Set the default style of code to generate for enums
1022938
pub fn default_enum_style(
1023939
mut self,
@@ -1496,17 +1412,6 @@ impl Builder {
14961412
self
14971413
}
14981414

1499-
/// Avoid generating any unstable Rust, such as Rust unions, in the generated bindings.
1500-
#[deprecated(note = "please use `rust_target` instead")]
1501-
pub fn unstable_rust(self, doit: bool) -> Self {
1502-
let rust_target = if doit {
1503-
RustTarget::Nightly
1504-
} else {
1505-
LATEST_STABLE_RUST
1506-
};
1507-
self.rust_target(rust_target)
1508-
}
1509-
15101415
/// Use core instead of libstd in the generated bindings.
15111416
pub fn use_core(mut self) -> Builder {
15121417
self.options.use_core = true;

0 commit comments

Comments
 (0)