diff --git a/CHANGELOG.md b/CHANGELOG.md index 0664a6d8c9..387d8e94a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/bindgen/features.rs b/bindgen/features.rs index 9f6535aa40..4fee5d63fc 100644 --- a/bindgen/features.rs +++ b/bindgen/features.rs @@ -2,6 +2,7 @@ #![deny(missing_docs)] #![deny(unused_extern_crates)] +#![allow(deprecated)] use std::io; use std::str::FromStr; @@ -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; diff --git a/bindgen/lib.rs b/bindgen/lib.rs index 53bbd8874c..4b71fb97ce 100644 --- a/bindgen/lib.rs +++ b/bindgen/lib.rs @@ -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 }