Skip to content
/ rust Public
forked from rust-lang/rust

Commit 14d29f9

Browse files
committed
Stabilize cfg_select
1 parent 99246f4 commit 14d29f9

File tree

29 files changed

+42
-101
lines changed

29 files changed

+42
-101
lines changed

compiler/rustc_attr_parsing/src/attributes/cfg_select.rs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -128,20 +128,14 @@ pub fn parse_cfg_select(
128128
}
129129
}
130130

131-
if let Some(features) = features
132-
&& features.enabled(sym::cfg_select)
133-
{
134-
let it = branches
135-
.reachable
136-
.iter()
137-
.map(|(entry, _, _)| CfgSelectPredicate::Cfg(entry.clone()))
138-
.chain(branches.wildcard.as_ref().map(|(t, _, _)| CfgSelectPredicate::Wildcard(*t)))
139-
.chain(
140-
branches.unreachable.iter().map(|(entry, _, _)| CfgSelectPredicate::clone(entry)),
141-
);
142-
143-
lint_unreachable(p, it, lint_node_id);
144-
}
131+
let it = branches
132+
.reachable
133+
.iter()
134+
.map(|(entry, _, _)| CfgSelectPredicate::Cfg(entry.clone()))
135+
.chain(branches.wildcard.as_ref().map(|(t, _, _)| CfgSelectPredicate::Wildcard(*t)))
136+
.chain(branches.unreachable.iter().map(|(entry, _, _)| CfgSelectPredicate::clone(entry)));
137+
138+
lint_unreachable(p, it, lint_node_id);
145139

146140
Ok(branches)
147141
}

compiler/rustc_codegen_cranelift/patches/0027-sysroot_tests-128bit-atomic-operations.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ index 1e336bf..35e6f54 100644
1717
@@ -2,4 +2,3 @@
1818
// tidy-alphabetical-start
1919
-#![cfg_attr(target_has_atomic = "128", feature(integer_atomics))]
20-
#![cfg_attr(test, feature(cfg_select))]
2120
#![feature(array_ptr_get)]
21+
#![feature(array_try_from_fn)]
2222
diff --git a/coretests/tests/atomic.rs b/coretests/tests/atomic.rs
2323
index b735957..ea728b6 100644
2424
--- a/coretests/tests/atomic.rs

compiler/rustc_data_structures/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
#![allow(rustc::default_hash_types)]
1212
#![allow(rustc::potential_query_instability)]
1313
#![cfg_attr(bootstrap, feature(assert_matches))]
14+
#![cfg_attr(bootstrap, feature(cfg_select))]
1415
#![cfg_attr(bootstrap, feature(cold_path))]
1516
#![cfg_attr(test, feature(test))]
1617
#![deny(unsafe_op_in_unsafe_fn)]
1718
#![feature(allocator_api)]
1819
#![feature(ascii_char)]
1920
#![feature(ascii_char_variants)]
2021
#![feature(auto_traits)]
21-
#![feature(cfg_select)]
2222
#![feature(const_default)]
2323
#![feature(const_trait_impl)]
2424
#![feature(dropck_eyepatch)]

compiler/rustc_feature/src/accepted.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ declare_features! (
102102
(accepted, cfg_doctest, "1.40.0", Some(62210)),
103103
/// Enables `#[cfg(panic = "...")]` config key.
104104
(accepted, cfg_panic, "1.60.0", Some(77443)),
105+
/// Provides a native way to easily manage multiple conditional flags without having to rewrite each clause multiple times.
106+
(accepted, cfg_select, "CURRENT_RUSTC_VERSION", Some(115585)),
105107
/// Allows `cfg(target_abi = "...")`.
106108
(accepted, cfg_target_abi, "1.78.0", Some(80970)),
107109
/// Allows `cfg(target_feature = "...")`.

compiler/rustc_feature/src/unstable.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,6 @@ declare_features! (
388388
(unstable, cfg_sanitize, "1.41.0", Some(39699)),
389389
/// Allows `cfg(sanitizer_cfi_generalize_pointers)` and `cfg(sanitizer_cfi_normalize_integers)`.
390390
(unstable, cfg_sanitizer_cfi, "1.77.0", Some(89653)),
391-
/// Provides a native way to easily manage multiple conditional flags without having to rewrite each clause multiple times.
392-
(unstable, cfg_select, "CURRENT_RUSTC_VERSION", Some(115585)),
393391
/// Allows `cfg(target(abi = "..."))`.
394392
(unstable, cfg_target_compact, "1.63.0", Some(96901)),
395393
/// Allows `cfg(target_has_atomic_load_store = "...")`.

compiler/rustc_lint_defs/src/builtin.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ declare_lint! {
864864
/// ### Example
865865
///
866866
/// ```rust
867-
/// #![feature(cfg_select)]
867+
/// # #![cfg_attr(bootstrap, feature(cfg_select))]
868868
/// cfg_select! {
869869
/// _ => (),
870870
/// windows => (),
@@ -882,7 +882,6 @@ declare_lint! {
882882
pub UNREACHABLE_CFG_SELECT_PREDICATES,
883883
Warn,
884884
"detects unreachable configuration predicates in the cfg_select macro",
885-
@feature_gate = cfg_select;
886885
}
887886

888887
declare_lint! {

compiler/rustc_span/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
1818
// tidy-alphabetical-start
1919
#![allow(internal_features)]
20+
#![cfg_attr(bootstrap, feature(cfg_select))]
2021
#![cfg_attr(bootstrap, feature(if_let_guard))]
2122
#![cfg_attr(target_arch = "loongarch64", feature(stdarch_loongarch))]
22-
#![feature(cfg_select)]
2323
#![feature(core_io_borrowed_buf)]
2424
#![feature(map_try_insert)]
2525
#![feature(negative_impls)]

library/core/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@
9898
// tidy-alphabetical-start
9999
#![feature(asm_experimental_arch)]
100100
#![feature(bstr_internals)]
101-
#![feature(cfg_select)]
102101
#![feature(cfg_target_has_reliable_f16_f128)]
103102
#![feature(const_carrying_mul_add)]
104103
#![feature(const_cmp)]
@@ -227,7 +226,7 @@ pub mod autodiff {
227226
#[unstable(feature = "contracts", issue = "128044")]
228227
pub mod contracts;
229228

230-
#[unstable(feature = "cfg_select", issue = "115585")]
229+
#[stable(feature = "cfg_select", since = "CURRENT_RUSTC_VERSION")]
231230
pub use crate::macros::cfg_select;
232231

233232
#[macro_use]

library/core/src/macros/mod.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,6 @@ pub macro assert_matches {
206206
/// # Example
207207
///
208208
/// ```
209-
/// #![feature(cfg_select)]
210-
///
211209
/// cfg_select! {
212210
/// unix => {
213211
/// fn foo() { /* unix specific functionality */ }
@@ -225,14 +223,12 @@ pub macro assert_matches {
225223
/// right-hand side:
226224
///
227225
/// ```
228-
/// #![feature(cfg_select)]
229-
///
230226
/// let _some_string = cfg_select! {
231227
/// unix => "With great power comes great electricity bills",
232228
/// _ => { "Behind every successful diet is an unwatched pizza" }
233229
/// };
234230
/// ```
235-
#[unstable(feature = "cfg_select", issue = "115585")]
231+
#[stable(feature = "cfg_select", since = "CURRENT_RUSTC_VERSION")]
236232
#[rustc_diagnostic_item = "cfg_select"]
237233
#[rustc_builtin_macro]
238234
pub macro cfg_select($($tt:tt)*) {

library/core/src/prelude/v1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ mod ambiguous_macros_only {
8080
#[doc(no_inline)]
8181
pub use self::ambiguous_macros_only::{env, panic};
8282

83-
#[unstable(feature = "cfg_select", issue = "115585")]
83+
#[stable(feature = "cfg_select", since = "CURRENT_RUSTC_VERSION")]
8484
#[doc(no_inline)]
8585
pub use crate::cfg_select;
8686

0 commit comments

Comments
 (0)