mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 15:54:15 +00:00
Move if let
behind a feature gate
This commit is contained in:
parent
976438f78f
commit
8a60952100
@ -2441,6 +2441,8 @@ The currently implemented features of the reference compiler are:
|
||||
* `default_type_params` - Allows use of default type parameters. The future of
|
||||
this feature is uncertain.
|
||||
|
||||
* `if_let` - Allows use of the `if let` desugaring syntax.
|
||||
|
||||
* `intrinsics` - Allows use of the "rust-intrinsics" ABI. Compiler intrinsics
|
||||
are inherently unstable and no promise about them is made.
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
% The Rust Reference Manual
|
||||
|
||||
The manual has moved, and is now called [the reference](reference.html).
|
||||
The manual has moved, and is now called [the reference](reference.html).
|
@ -71,6 +71,8 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
|
||||
("associated_types", Active),
|
||||
("visible_private_types", Active),
|
||||
|
||||
("if_let", Active),
|
||||
|
||||
// if you change this list without updating src/doc/rust.md, cmr will be sad
|
||||
|
||||
// A temporary feature gate used to enable parser extensions needed
|
||||
@ -356,6 +358,10 @@ impl<'a, 'v> Visitor<'v> for Context<'a> {
|
||||
e.span,
|
||||
"tuple indexing is experimental");
|
||||
}
|
||||
ast::ExprIfLet(..) => {
|
||||
self.gate_feature("if_let", e.span,
|
||||
"`if let` desugaring is experimental");
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
visit::walk_expr(self, e);
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(macro_rules)]
|
||||
#![feature(macro_rules,if_let)]
|
||||
|
||||
fn macros() {
|
||||
macro_rules! foo{
|
||||
|
@ -9,6 +9,7 @@
|
||||
// except according to those terms.
|
||||
|
||||
#![deny(unnecessary_parens)]
|
||||
#![feature(if_let)]
|
||||
|
||||
#[deriving(Eq, PartialEq)]
|
||||
struct X { y: bool }
|
||||
|
@ -8,6 +8,8 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(if_let)]
|
||||
|
||||
pub fn main() {
|
||||
let x = Some(3i);
|
||||
if let Some(y) = x {
|
||||
|
Loading…
Reference in New Issue
Block a user