Skip to content

Commit 152c851

Browse files
committed
Make forward compatibility lint deprecated_cfg_attr_crate_type_name deny by default
1 parent c11207e commit 152c851

File tree

4 files changed

+9
-16
lines changed

4 files changed

+9
-16
lines changed

compiler/rustc_lint_defs/src/builtin.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3068,7 +3068,7 @@ declare_lint! {
30683068
///
30693069
/// ### Example
30703070
///
3071-
/// ```rust
3071+
/// ```rust,compile_fail
30723072
/// #![cfg_attr(debug_assertions, crate_type = "lib")]
30733073
/// ```
30743074
///
@@ -3088,7 +3088,7 @@ declare_lint! {
30883088
/// rustc instead of `#![cfg_attr(..., crate_type = "...")]` and
30893089
/// `--crate-name` instead of `#![cfg_attr(..., crate_name = "...")]`.
30903090
pub DEPRECATED_CFG_ATTR_CRATE_TYPE_NAME,
3091-
Warn,
3091+
Deny,
30923092
"detects usage of `#![cfg_attr(..., crate_type/crate_name = \"...\")]`",
30933093
@future_incompatible = FutureIncompatibleInfo {
30943094
reference: "issue #91632 <https://github.com/rust-lang/rust/issues/91632>",

src/test/codegen/external-no-mangle-statics.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
// revisions: lib staticlib
22
// ignore-emscripten default visibility is hidden
33
// compile-flags: -O
4+
// [lib] compile-flags: --crate-type lib
5+
// [staticlib] compile-flags: --crate-type staticlib
46
// `#[no_mangle]`d static variables always have external linkage, i.e., no `internal` in their
57
// definitions
68

7-
#![cfg_attr(lib, crate_type = "lib")]
8-
#![cfg_attr(staticlib, crate_type = "staticlib")]
9-
109
// CHECK: @A = local_unnamed_addr constant
1110
#[no_mangle]
1211
static A: u8 = 0;

src/test/ui/cfg/future-compat-crate-attributes-using-cfg_attr.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// check-fail
22
// compile-flags:--cfg foo
33

4-
#![deny(warnings)]
54
#![cfg_attr(foo, crate_type="bin")]
65
//~^ERROR `crate_type` within
76
//~| WARN this was previously accepted

src/test/ui/cfg/future-compat-crate-attributes-using-cfg_attr.stderr

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

1611
error: `crate_name` within an `#![cfg_attr] attribute is deprecated`
17-
--> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:10:18
12+
--> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:9:18
1813
|
1914
LL | #![cfg_attr(foo, crate_name="bar")]
2015
| ^^^^^^^^^^^^^^^^
@@ -23,7 +18,7 @@ LL | #![cfg_attr(foo, crate_name="bar")]
2318
= note: for more information, see issue #91632 <https://github.com/rust-lang/rust/issues/91632>
2419

2520
error: `crate_type` within an `#![cfg_attr] attribute is deprecated`
26-
--> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:5:18
21+
--> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:4:18
2722
|
2823
LL | #![cfg_attr(foo, crate_type="bin")]
2924
| ^^^^^^^^^^^^^^^^
@@ -32,7 +27,7 @@ LL | #![cfg_attr(foo, crate_type="bin")]
3227
= note: for more information, see issue #91632 <https://github.com/rust-lang/rust/issues/91632>
3328

3429
error: `crate_name` within an `#![cfg_attr] attribute is deprecated`
35-
--> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:10:18
30+
--> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:9:18
3631
|
3732
LL | #![cfg_attr(foo, crate_name="bar")]
3833
| ^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)