Skip to content

Commit 3c4ad55

Browse files
committed
Add inline_const feature flag
1 parent 6999ff3 commit 3c4ad55

File tree

5 files changed

+19
-0
lines changed

5 files changed

+19
-0
lines changed

compiler/rustc_ast_passes/src/feature_gate.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,7 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session) {
629629
gate_all!(const_trait_bound_opt_out, "`?const` on trait bounds is experimental");
630630
gate_all!(const_trait_impl, "const trait impls are experimental");
631631
gate_all!(half_open_range_patterns, "half-open range patterns are unstable");
632+
gate_all!(inline_const, "inline-const is experimental");
632633

633634
// All uses of `gate_all!` below this point were added in #65742,
634635
// and subsequently disabled (with the non-early gating readded).

compiler/rustc_feature/src/active.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,9 @@ declare_features! (
598598
/// Allows `#[instruction_set(_)]` attribute
599599
(active, isa_attribute, "1.48.0", Some(74727), None),
600600

601+
/// Allow anonymous constants from an inline `const` block
602+
(active, inline_const, "1.49.0", Some(76001), None),
603+
601604
// -------------------------------------------------------------------------
602605
// feature-group-end: actual feature gates
603606
// -------------------------------------------------------------------------

compiler/rustc_span/src/symbol.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,7 @@ symbols! {
593593
infer_static_outlives_requirements,
594594
inlateout,
595595
inline,
596+
inline_const,
596597
inout,
597598
instruction_set,
598599
intel,
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
fn main() {
2+
let _ = const {
3+
//~^ ERROR expected expression, found keyword `const`
4+
true
5+
};
6+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: expected expression, found keyword `const`
2+
--> $DIR/feature-gate-inline_const.rs:2:13
3+
|
4+
LL | let _ = const {
5+
| ^^^^^ expected expression
6+
7+
error: aborting due to previous error
8+

0 commit comments

Comments
 (0)