Skip to content

Commit 1ef99f1

Browse files
committed
stabilise cfg_attr
1 parent 21ac19d commit 1ef99f1

14 files changed

+7
-94
lines changed

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

-20
This file was deleted.

src/libsyntax/config.rs

+2-20
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,6 @@ impl<'a> StripUnconfigured<'a> {
9494
return vec![attr];
9595
}
9696

97-
let gate_cfg_attr_multi = if let Some(ref features) = self.features {
98-
!features.cfg_attr_multi
99-
} else {
100-
false
101-
};
10297
let cfg_attr_span = attr.span;
10398

10499
let (cfg_predicate, expanded_attrs) = match attr.parse(self.sess, |parser| {
@@ -130,21 +125,8 @@ impl<'a> StripUnconfigured<'a> {
130125
// Check feature gate and lint on zero attributes in source. Even if the feature is gated,
131126
// we still compute as if it wasn't, since the emitted error will stop compilation further
132127
// 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) => {}
128+
if expanded_attrs.len() == 0 {
129+
// FIXME: Emit unused attribute lint here.
148130
}
149131

150132
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-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// compile-pass
55

66
#![warn(unused_must_use)]
7-
#![feature(cfg_attr_multi)]
7+
#![cfg_attr(stage0, feature(cfg_attr_multi))]
88

99
#[cfg_attr(any(), deprecated, must_use)]
1010
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-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-true.rs

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

77
#![warn(unused_must_use)]
8-
#![feature(cfg_attr_multi)]
8+
#![cfg_attr(stage0, feature(cfg_attr_multi))]
99

1010
#[cfg_attr(all(), deprecated, must_use)]
1111
struct MustUseDeprecated {}

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

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

3-
#![feature(cfg_attr_multi)]
3+
#![cfg_attr(stage0, feature(cfg_attr_multi))]
44

55
// Completely empty `cfg_attr` input
66
#[cfg_attr()] //~ error: expected identifier, found `)`

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)