Skip to content

Commit 8a60952

Browse files
lilyballJakub Wieczorek
authored andcommitted
Move if let behind a feature gate
1 parent 976438f commit 8a60952

File tree

6 files changed

+13
-2
lines changed

6 files changed

+13
-2
lines changed

src/doc/reference.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2441,6 +2441,8 @@ The currently implemented features of the reference compiler are:
24412441
* `default_type_params` - Allows use of default type parameters. The future of
24422442
this feature is uncertain.
24432443

2444+
* `if_let` - Allows use of the `if let` desugaring syntax.
2445+
24442446
* `intrinsics` - Allows use of the "rust-intrinsics" ABI. Compiler intrinsics
24452447
are inherently unstable and no promise about them is made.
24462448

src/doc/rust.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
% The Rust Reference Manual
22

3-
The manual has moved, and is now called [the reference](reference.html).
3+
The manual has moved, and is now called [the reference](reference.html).

src/libsyntax/feature_gate.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
7171
("associated_types", Active),
7272
("visible_private_types", Active),
7373

74+
("if_let", Active),
75+
7476
// if you change this list without updating src/doc/rust.md, cmr will be sad
7577

7678
// A temporary feature gate used to enable parser extensions needed
@@ -356,6 +358,10 @@ impl<'a, 'v> Visitor<'v> for Context<'a> {
356358
e.span,
357359
"tuple indexing is experimental");
358360
}
361+
ast::ExprIfLet(..) => {
362+
self.gate_feature("if_let", e.span,
363+
"`if let` desugaring is experimental");
364+
}
359365
_ => {}
360366
}
361367
visit::walk_expr(self, e);

src/test/compile-fail/if-let.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(macro_rules)]
11+
#![feature(macro_rules,if_let)]
1212

1313
fn macros() {
1414
macro_rules! foo{

src/test/compile-fail/lint-unnecessary-parens.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
#![deny(unnecessary_parens)]
12+
#![feature(if_let)]
1213

1314
#[deriving(Eq, PartialEq)]
1415
struct X { y: bool }

src/test/run-pass/if-let.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![feature(if_let)]
12+
1113
pub fn main() {
1214
let x = Some(3i);
1315
if let Some(y) = x {

0 commit comments

Comments
 (0)