Skip to content

Commit

Permalink
Deprecate Rust targets lower or equal than 1.30 (#2356)
Browse files Browse the repository at this point in the history
  • Loading branch information
pvdrz authored Nov 22, 2022
1 parent 046d6f9 commit 7e41749
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@

* Replace the `name: &str` argument for `ParseCallbacks::add_derives` by
`info: DeriveInfo`.
* All the rust targets equal or lower than `1.30` are being deprecated and
will be removed in the future. If you have a good reason to use any of these
targets, please report it in the issue tracker.

## Removed

Expand Down
21 changes: 11 additions & 10 deletions bindgen/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#![deny(missing_docs)]
#![deny(unused_extern_crates)]
#![allow(deprecated)]

use std::io;
use std::str::FromStr;
Expand Down Expand Up @@ -86,35 +87,35 @@ macro_rules! rust_target_base {
( $x_macro:ident ) => {
$x_macro!(
/// Rust stable 1.0
=> Stable_1_0 => 1.0;
#[deprecated = "This rust target is deprecated. If you have a good reason to use this target please report it at https://github.com/rust-lang/rust-bindgen/issues"] => Stable_1_0 => 1.0;
/// Rust stable 1.17
/// * Static lifetime elision ([RFC 1623](https://github.com/rust-lang/rfcs/blob/master/text/1623-static.md))
=> Stable_1_17 => 1.17;
#[deprecated = "This rust target is deprecated. If you have a good reason to use this target please report it at https://github.com/rust-lang/rust-bindgen/issues"] => Stable_1_17 => 1.17;
/// Rust stable 1.19
/// * Untagged unions ([RFC 1444](https://github.com/rust-lang/rfcs/blob/master/text/1444-union.md))
=> Stable_1_19 => 1.19;
#[deprecated = "This rust target is deprecated. If you have a good reason to use this target please report it at https://github.com/rust-lang/rust-bindgen/issues"] => Stable_1_19 => 1.19;
/// Rust stable 1.20
/// * Associated constants ([PR](https://github.com/rust-lang/rust/pull/42809))
=> Stable_1_20 => 1.20;
#[deprecated = "This rust target is deprecated. If you have a good reason to use this target please report it at https://github.com/rust-lang/rust-bindgen/issues"] => Stable_1_20 => 1.20;
/// Rust stable 1.21
/// * Builtin impls for `Clone` ([PR](https://github.com/rust-lang/rust/pull/43690))
=> Stable_1_21 => 1.21;
#[deprecated = "This rust target is deprecated. If you have a good reason to use this target please report it at https://github.com/rust-lang/rust-bindgen/issues"] => Stable_1_21 => 1.21;
/// Rust stable 1.25
/// * `repr(align)` ([PR](https://github.com/rust-lang/rust/pull/47006))
=> Stable_1_25 => 1.25;
#[deprecated = "This rust target is deprecated. If you have a good reason to use this target please report it at https://github.com/rust-lang/rust-bindgen/issues"] => Stable_1_25 => 1.25;
/// Rust stable 1.26
/// * [i128 / u128 support](https://doc.rust-lang.org/std/primitive.i128.html)
=> Stable_1_26 => 1.26;
#[deprecated = "This rust target is deprecated. If you have a good reason to use this target please report it at https://github.com/rust-lang/rust-bindgen/issues"] => Stable_1_26 => 1.26;
/// Rust stable 1.27
/// * `must_use` attribute on functions ([PR](https://github.com/rust-lang/rust/pull/48925))
=> Stable_1_27 => 1.27;
#[deprecated = "This rust target is deprecated. If you have a good reason to use this target please report it at https://github.com/rust-lang/rust-bindgen/issues"] => Stable_1_27 => 1.27;
/// Rust stable 1.28
/// * `repr(transparent)` ([PR](https://github.com/rust-lang/rust/pull/51562))
=> Stable_1_28 => 1.28;
#[deprecated = "This rust target is deprecated. If you have a good reason to use this target please report it at https://github.com/rust-lang/rust-bindgen/issues"] => Stable_1_28 => 1.28;
/// Rust stable 1.30
/// * `const fn` support for limited cases ([PR](https://github.com/rust-lang/rust/pull/54835/)
/// * [c_void available in core](https://doc.rust-lang.org/core/ffi/enum.c_void.html)
=> Stable_1_30 => 1.30;
#[deprecated = "This rust target is deprecated. If you have a good reason to use this target please report it at https://github.com/rust-lang/rust-bindgen/issues"] => Stable_1_30 => 1.30;
/// Rust stable 1.33
/// * repr(packed(N)) ([PR](https://github.com/rust-lang/rust/pull/57049))
=> Stable_1_33 => 1.33;
Expand Down
7 changes: 7 additions & 0 deletions bindgen/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,13 @@ impl Builder {
///
/// The default is the latest stable Rust version
pub fn rust_target(mut self, rust_target: RustTarget) -> Self {
#[allow(deprecated)]
if rust_target <= RustTarget::Stable_1_30 {
warn!(
"The {} rust target is deprecated. If you have a good reason to use this target please report it at https://github.com/rust-lang/rust-bindgen/issues",
String::from(rust_target)
);
}
self.options.set_rust_target(rust_target);
self
}
Expand Down

0 comments on commit 7e41749

Please sign in to comment.