Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate Rust targets lower or equal than 1.30 #2356

Merged
merged 3 commits into from Nov 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -157,6 +157,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
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
Expand Up @@ -727,6 +727,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