Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement const expressions and patterns (RFC 2920) #77124

Merged
merged 11 commits into from
Oct 17, 2020
Next Next commit
Add inline_const feature flag
  • Loading branch information
spastorino committed Oct 16, 2020
commit 3c4ad5508242bd560d095f1380bb8d739a0cbba2
1 change: 1 addition & 0 deletions compiler/rustc_ast_passes/src/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,7 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session) {
gate_all!(const_trait_bound_opt_out, "`?const` on trait bounds is experimental");
gate_all!(const_trait_impl, "const trait impls are experimental");
gate_all!(half_open_range_patterns, "half-open range patterns are unstable");
gate_all!(inline_const, "inline-const is experimental");

// All uses of `gate_all!` below this point were added in #65742,
// and subsequently disabled (with the non-early gating readded).
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_feature/src/active.rs
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,9 @@ declare_features! (
/// Allows `#[instruction_set(_)]` attribute
(active, isa_attribute, "1.48.0", Some(74727), None),

/// Allow anonymous constants from an inline `const` block
(active, inline_const, "1.49.0", Some(76001), None),

// -------------------------------------------------------------------------
// feature-group-end: actual feature gates
// -------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ symbols! {
infer_static_outlives_requirements,
inlateout,
inline,
inline_const,
inout,
instruction_set,
intel,
Expand Down
6 changes: 6 additions & 0 deletions src/test/ui/feature-gate-inline_const.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
fn main() {
let _ = const {
//~^ ERROR expected expression, found keyword `const`
true
};
}
8 changes: 8 additions & 0 deletions src/test/ui/feature-gate-inline_const.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: expected expression, found keyword `const`
--> $DIR/feature-gate-inline_const.rs:2:13
|
LL | let _ = const {
| ^^^^^ expected expression

error: aborting due to previous error