Skip to content

Commit 7ad470c

Browse files
committed
Auto merge of #57332 - Dylan-DPC:feature/stabilise-cfg-attr, r=Centril
stabilize cfg_attr_multi Stabilizes cfg_attr_multi feature Related to #54881 Will add the lint in a seperate PR r? @Centril
2 parents 9d54812 + 13f8ad8 commit 7ad470c

18 files changed

+16
-110
lines changed

src/doc/unstable-book/src/language-features/cfg-attr-multi.md

-20
This file was deleted.

src/libsyntax/config.rs

+2-23
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use feature_gate::{
55
Features,
66
get_features,
77
GateIssue,
8-
emit_feature_err,
98
};
109
use {fold, attr};
1110
use ast;
@@ -94,13 +93,6 @@ impl<'a> StripUnconfigured<'a> {
9493
return vec![attr];
9594
}
9695

97-
let gate_cfg_attr_multi = if let Some(ref features) = self.features {
98-
!features.cfg_attr_multi
99-
} else {
100-
false
101-
};
102-
let cfg_attr_span = attr.span;
103-
10496
let (cfg_predicate, expanded_attrs) = match attr.parse(self.sess, |parser| {
10597
parser.expect(&token::OpenDelim(token::Paren))?;
10698

@@ -130,21 +122,8 @@ impl<'a> StripUnconfigured<'a> {
130122
// Check feature gate and lint on zero attributes in source. Even if the feature is gated,
131123
// we still compute as if it wasn't, since the emitted error will stop compilation further
132124
// along the compilation.
133-
match (expanded_attrs.len(), gate_cfg_attr_multi) {
134-
(0, false) => {
135-
// FIXME: Emit unused attribute lint here.
136-
},
137-
(1, _) => {},
138-
(_, true) => {
139-
emit_feature_err(
140-
self.sess,
141-
"cfg_attr_multi",
142-
cfg_attr_span,
143-
GateIssue::Language,
144-
"cfg_attr with zero or more than one attributes is experimental",
145-
);
146-
},
147-
(_, false) => {}
125+
if expanded_attrs.len() == 0 {
126+
// FIXME: Emit unused attribute lint here.
148127
}
149128

150129
if attr::cfg_matches(&cfg_predicate, self.sess, self.features) {

src/libsyntax/feature_gate.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -465,9 +465,6 @@ declare_features! (
465465
// Allows `impl Trait` in bindings (`let`, `const`, `static`).
466466
(active, impl_trait_in_bindings, "1.30.0", Some(34511), None),
467467

468-
// `#[cfg_attr(predicate, multiple, attributes, here)]`
469-
(active, cfg_attr_multi, "1.31.0", Some(54881), None),
470-
471468
// Allows `const _: TYPE = VALUE`.
472469
(active, underscore_const_names, "1.31.0", Some(54912), None),
473470

@@ -689,6 +686,8 @@ declare_features! (
689686
(accepted, repr_packed, "1.33.0", Some(33158), None),
690687
// Allows calling `const unsafe fn` inside `unsafe` blocks in `const fn` functions.
691688
(accepted, min_const_unsafe_fn, "1.33.0", Some(55607), None),
689+
// `#[cfg_attr(predicate, multiple, attributes, here)]`
690+
(accepted, cfg_attr_multi, "1.33.0", Some(54881), None),
692691
);
693692

694693
// If you change this, please modify `src/doc/unstable-book` as well. You must

src/test/ui/conditional-compilation/cfg-attr-multi-false.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
// compile-pass
55

66
#![warn(unused_must_use)]
7-
#![feature(cfg_attr_multi)]
87

98
#[cfg_attr(any(), deprecated, must_use)]
109
struct Struct {}

src/test/ui/conditional-compilation/cfg-attr-multi-invalid-1.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// compile-flags: --cfg broken
22

3-
#![feature(cfg_attr_multi)]
43
#![crate_type = "lib"]
54
#![cfg_attr(broken, no_core, no_std)] //~ ERROR no_core is experimental
65

src/test/ui/conditional-compilation/cfg-attr-multi-invalid-1.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0658]: no_core is experimental (see issue #29639)
2-
--> $DIR/cfg-attr-multi-invalid-1.rs:5:21
2+
--> $DIR/cfg-attr-multi-invalid-1.rs:4:21
33
|
44
LL | #![cfg_attr(broken, no_core, no_std)] //~ ERROR no_core is experimental
55
| ^^^^^^^

src/test/ui/conditional-compilation/cfg-attr-multi-invalid-2.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// compile-flags: --cfg broken
22

3-
#![feature(cfg_attr_multi)]
43
#![crate_type = "lib"]
54
#![cfg_attr(broken, no_std, no_core)] //~ ERROR no_core is experimental
65

src/test/ui/conditional-compilation/cfg-attr-multi-invalid-2.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0658]: no_core is experimental (see issue #29639)
2-
--> $DIR/cfg-attr-multi-invalid-2.rs:5:29
2+
--> $DIR/cfg-attr-multi-invalid-2.rs:4:29
33
|
44
LL | #![cfg_attr(broken, no_std, no_core)] //~ ERROR no_core is experimental
55
| ^^^^^^^

src/test/ui/conditional-compilation/cfg-attr-multi-true.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
// compile-pass
66

77
#![warn(unused_must_use)]
8-
#![feature(cfg_attr_multi)]
98

109
#[cfg_attr(all(), deprecated, must_use)]
1110
struct MustUseDeprecated {}

src/test/ui/conditional-compilation/cfg-attr-multi-true.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
warning: use of deprecated item 'MustUseDeprecated'
2-
--> $DIR/cfg-attr-multi-true.rs:13:6
2+
--> $DIR/cfg-attr-multi-true.rs:12:6
33
|
44
LL | impl MustUseDeprecated { //~ warning: use of deprecated item
55
| ^^^^^^^^^^^^^^^^^
66
|
77
= note: #[warn(deprecated)] on by default
88

99
warning: use of deprecated item 'MustUseDeprecated'
10-
--> $DIR/cfg-attr-multi-true.rs:20:5
10+
--> $DIR/cfg-attr-multi-true.rs:19:5
1111
|
1212
LL | MustUseDeprecated::new(); //~ warning: use of deprecated item
1313
| ^^^^^^^^^^^^^^^^^^^^^^
1414

1515
warning: use of deprecated item 'MustUseDeprecated'
16-
--> $DIR/cfg-attr-multi-true.rs:14:17
16+
--> $DIR/cfg-attr-multi-true.rs:13:17
1717
|
1818
LL | fn new() -> MustUseDeprecated { //~ warning: use of deprecated item
1919
| ^^^^^^^^^^^^^^^^^
2020

2121
warning: use of deprecated item 'MustUseDeprecated'
22-
--> $DIR/cfg-attr-multi-true.rs:15:9
22+
--> $DIR/cfg-attr-multi-true.rs:14:9
2323
|
2424
LL | MustUseDeprecated {} //~ warning: use of deprecated item
2525
| ^^^^^^^^^^^^^^^^^
2626

2727
warning: unused `MustUseDeprecated` that must be used
28-
--> $DIR/cfg-attr-multi-true.rs:20:5
28+
--> $DIR/cfg-attr-multi-true.rs:19:5
2929
|
3030
LL | MustUseDeprecated::new(); //~ warning: use of deprecated item
3131
| ^^^^^^^^^^^^^^^^^^^^^^^^^

src/test/ui/conditional-compilation/cfg-attr-parse.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// Parse `cfg_attr` with varying numbers of attributes and trailing commas
22

3-
#![feature(cfg_attr_multi)]
4-
53
// Completely empty `cfg_attr` input
64
#[cfg_attr()] //~ error: expected identifier, found `)`
75
struct NoConfigurationPredicate;

src/test/ui/conditional-compilation/cfg-attr-parse.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
error: expected identifier, found `)`
2-
--> $DIR/cfg-attr-parse.rs:6:12
2+
--> $DIR/cfg-attr-parse.rs:4:12
33
|
44
LL | #[cfg_attr()] //~ error: expected identifier, found `)`
55
| ^ expected identifier
66

77
error: expected `,`, found `)`
8-
--> $DIR/cfg-attr-parse.rs:10:17
8+
--> $DIR/cfg-attr-parse.rs:8:17
99
|
1010
LL | #[cfg_attr(all())] //~ error: expected `,`, found `)`
1111
| ^ expected `,`
1212

1313
error: expected identifier, found `,`
14-
--> $DIR/cfg-attr-parse.rs:18:18
14+
--> $DIR/cfg-attr-parse.rs:16:18
1515
|
1616
LL | #[cfg_attr(all(),,)] //~ ERROR expected identifier
1717
| ^ expected identifier
1818

1919
error: expected identifier, found `,`
20-
--> $DIR/cfg-attr-parse.rs:30:28
20+
--> $DIR/cfg-attr-parse.rs:28:28
2121
|
2222
LL | #[cfg_attr(all(), must_use,,)] //~ ERROR expected identifier
2323
| ^ expected identifier
2424

2525
error: expected identifier, found `,`
26-
--> $DIR/cfg-attr-parse.rs:42:40
26+
--> $DIR/cfg-attr-parse.rs:40:40
2727
|
2828
LL | #[cfg_attr(all(), must_use, deprecated,,)] //~ ERROR expected identifier
2929
| ^ expected identifier

src/test/ui/feature-gates/feature-gate-cfg-attr-multi-1.rs

-5
This file was deleted.

src/test/ui/feature-gates/feature-gate-cfg-attr-multi-1.stderr

-11
This file was deleted.

src/test/ui/feature-gates/feature-gate-cfg-attr-multi-2.rs

-3
This file was deleted.

src/test/ui/feature-gates/feature-gate-cfg-attr-multi-2.stderr

-11
This file was deleted.

src/test/ui/feature-gates/feature-gate-cfg-attr-multi-bootstrap-1.rs

-7
This file was deleted.

src/test/ui/feature-gates/feature-gate-cfg-attr-multi-bootstrap-2.rs

-9
This file was deleted.

0 commit comments

Comments
 (0)