about summary refs log tree commit diff
diff options
context:
space:
mode:
authorjdonszelmann <jonabent@gmail.com>2024-05-14 16:10:05 +0200
committerjdonszelmann <jonabent@gmail.com>2024-05-14 16:11:26 +0200
commit42119ff45c75e5e3ced06f1f45a9e4853fb5bca9 (patch)
tree493a5567d7f5b8bf8c601f4f0910b86e10d7db5f
parentc45e831d8fcd33d656047ba97d263c4b91a00735 (diff)
downloadrust-42119ff45c75e5e3ced06f1f45a9e4853fb5bca9.tar.gz
rust-42119ff45c75e5e3ced06f1f45a9e4853fb5bca9.zip
create a feature gate
-rw-r--r--compiler/rustc_ast_passes/src/feature_gate.rs1
-rw-r--r--compiler/rustc_feature/src/unstable.rs2
-rw-r--r--compiler/rustc_span/src/symbol.rs1
-rw-r--r--tests/ui/feature-gates/feature-gate-global-registration.rs1
4 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs
index 6622caaaab4..a522f04b21d 100644
--- a/compiler/rustc_ast_passes/src/feature_gate.rs
+++ b/compiler/rustc_ast_passes/src/feature_gate.rs
@@ -560,6 +560,7 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
     gate_all!(postfix_match, "postfix match is experimental");
     gate_all!(mut_ref, "mutable by-reference bindings are experimental");
     gate_all!(precise_capturing, "precise captures on `impl Trait` are experimental");
+    gate_all!(global_registration, "global registration is experimental");
 
     if !visitor.features.never_patterns {
         if let Some(spans) = spans.get(&sym::never_patterns) {
diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs
index 60b386acf91..a25b7ef10a4 100644
--- a/compiler/rustc_feature/src/unstable.rs
+++ b/compiler/rustc_feature/src/unstable.rs
@@ -487,6 +487,8 @@ declare_features! (
     (incomplete, generic_const_exprs, "1.56.0", Some(76560)),
     /// Allows generic parameters and where-clauses on free & associated const items.
     (incomplete, generic_const_items, "1.73.0", Some(113521)),
+    /// Allows registring static items globally, possibly across crates, to iterate over at runtime.
+    (unstable, global_registration, "CURRENT_RUSTC_VERSION", Some(125119)),
     /// Allows using `..=X` as a patterns in slices.
     (unstable, half_open_range_patterns_in_slices, "1.66.0", Some(67264)),
     /// Allows `if let` guard in match arms.
diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs
index d41059e8c24..192c7a27bd6 100644
--- a/compiler/rustc_span/src/symbol.rs
+++ b/compiler/rustc_span/src/symbol.rs
@@ -928,6 +928,7 @@ symbols! {
         global_alloc_ty,
         global_allocator,
         global_asm,
+        global_registration,
         globs,
         gt,
         half_open_range_patterns,
diff --git a/tests/ui/feature-gates/feature-gate-global-registration.rs b/tests/ui/feature-gates/feature-gate-global-registration.rs
new file mode 100644
index 00000000000..77072727ec5
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-global-registration.rs
@@ -0,0 +1 @@
+//! WIP