1
Fork 0

Make forward compatibility lint deprecated_cfg_attr_crate_type_name deny by default

This commit is contained in:
est31 2022-07-27 00:24:30 +02:00
parent c11207ec89
commit 152c851f89
4 changed files with 9 additions and 16 deletions

View file

@ -3068,7 +3068,7 @@ declare_lint! {
/// ///
/// ### Example /// ### Example
/// ///
/// ```rust /// ```rust,compile_fail
/// #![cfg_attr(debug_assertions, crate_type = "lib")] /// #![cfg_attr(debug_assertions, crate_type = "lib")]
/// ``` /// ```
/// ///
@ -3088,7 +3088,7 @@ declare_lint! {
/// rustc instead of `#![cfg_attr(..., crate_type = "...")]` and /// rustc instead of `#![cfg_attr(..., crate_type = "...")]` and
/// `--crate-name` instead of `#![cfg_attr(..., crate_name = "...")]`. /// `--crate-name` instead of `#![cfg_attr(..., crate_name = "...")]`.
pub DEPRECATED_CFG_ATTR_CRATE_TYPE_NAME, pub DEPRECATED_CFG_ATTR_CRATE_TYPE_NAME,
Warn, Deny,
"detects usage of `#![cfg_attr(..., crate_type/crate_name = \"...\")]`", "detects usage of `#![cfg_attr(..., crate_type/crate_name = \"...\")]`",
@future_incompatible = FutureIncompatibleInfo { @future_incompatible = FutureIncompatibleInfo {
reference: "issue #91632 <https://github.com/rust-lang/rust/issues/91632>", reference: "issue #91632 <https://github.com/rust-lang/rust/issues/91632>",

View file

@ -1,12 +1,11 @@
// revisions: lib staticlib // revisions: lib staticlib
// ignore-emscripten default visibility is hidden // ignore-emscripten default visibility is hidden
// compile-flags: -O // compile-flags: -O
// [lib] compile-flags: --crate-type lib
// [staticlib] compile-flags: --crate-type staticlib
// `#[no_mangle]`d static variables always have external linkage, i.e., no `internal` in their // `#[no_mangle]`d static variables always have external linkage, i.e., no `internal` in their
// definitions // definitions
#![cfg_attr(lib, crate_type = "lib")]
#![cfg_attr(staticlib, crate_type = "staticlib")]
// CHECK: @A = local_unnamed_addr constant // CHECK: @A = local_unnamed_addr constant
#[no_mangle] #[no_mangle]
static A: u8 = 0; static A: u8 = 0;

View file

@ -1,7 +1,6 @@
// check-fail // check-fail
// compile-flags:--cfg foo // compile-flags:--cfg foo
#![deny(warnings)]
#![cfg_attr(foo, crate_type="bin")] #![cfg_attr(foo, crate_type="bin")]
//~^ERROR `crate_type` within //~^ERROR `crate_type` within
//~| WARN this was previously accepted //~| WARN this was previously accepted

View file

@ -1,20 +1,15 @@
error: `crate_type` within an `#![cfg_attr] attribute is deprecated` error: `crate_type` within an `#![cfg_attr] attribute is deprecated`
--> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:5:18 --> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:4:18
| |
LL | #![cfg_attr(foo, crate_type="bin")] LL | #![cfg_attr(foo, crate_type="bin")]
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
| |
note: the lint level is defined here = note: `#[deny(deprecated_cfg_attr_crate_type_name)]` on by default
--> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:4:9
|
LL | #![deny(warnings)]
| ^^^^^^^^
= note: `#[deny(deprecated_cfg_attr_crate_type_name)]` implied by `#[deny(warnings)]`
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #91632 <https://github.com/rust-lang/rust/issues/91632> = note: for more information, see issue #91632 <https://github.com/rust-lang/rust/issues/91632>
error: `crate_name` within an `#![cfg_attr] attribute is deprecated` error: `crate_name` within an `#![cfg_attr] attribute is deprecated`
--> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:10:18 --> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:9:18
| |
LL | #![cfg_attr(foo, crate_name="bar")] LL | #![cfg_attr(foo, crate_name="bar")]
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
@ -23,7 +18,7 @@ LL | #![cfg_attr(foo, crate_name="bar")]
= note: for more information, see issue #91632 <https://github.com/rust-lang/rust/issues/91632> = note: for more information, see issue #91632 <https://github.com/rust-lang/rust/issues/91632>
error: `crate_type` within an `#![cfg_attr] attribute is deprecated` error: `crate_type` within an `#![cfg_attr] attribute is deprecated`
--> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:5:18 --> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:4:18
| |
LL | #![cfg_attr(foo, crate_type="bin")] LL | #![cfg_attr(foo, crate_type="bin")]
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
@ -32,7 +27,7 @@ LL | #![cfg_attr(foo, crate_type="bin")]
= note: for more information, see issue #91632 <https://github.com/rust-lang/rust/issues/91632> = note: for more information, see issue #91632 <https://github.com/rust-lang/rust/issues/91632>
error: `crate_name` within an `#![cfg_attr] attribute is deprecated` error: `crate_name` within an `#![cfg_attr] attribute is deprecated`
--> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:10:18 --> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:9:18
| |
LL | #![cfg_attr(foo, crate_name="bar")] LL | #![cfg_attr(foo, crate_name="bar")]
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^