diff options
| author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2015-01-07 15:15:34 +0100 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2015-01-08 00:41:43 +0100 |
| commit | 4a31aaddb364f5ab8280242a1016bdd3d10dcaed (patch) | |
| tree | e62158c713cb8491833f4cff687dca10faabc5aa /src/libsyntax/feature_gate.rs | |
| parent | 82af2a1847fd51dd82f38666283ec9ff174d7a74 (diff) | |
| download | rust-4a31aaddb364f5ab8280242a1016bdd3d10dcaed.tar.gz rust-4a31aaddb364f5ab8280242a1016bdd3d10dcaed.zip | |
Added `box_syntax` feature gate; added to std and rustc crates for bootstrap.
To avoid using the feauture, change uses of `box <expr>` to `Box::new(<expr>)` alternative, as noted by the feature gate message. (Note that box patterns have no analogous trivial replacement, at least not in general; you need to revise the code to do a partial match, deref, and then the rest of the match.) [breaking-change]
Diffstat (limited to 'src/libsyntax/feature_gate.rs')
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index f10113254de..fbff5e16ef5 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -70,6 +70,7 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[ ("associated_types", Accepted), ("visible_private_types", Active), ("slicing_syntax", Active), + ("box_syntax", Active), ("if_let", Accepted), ("while_let", Accepted), @@ -343,6 +344,12 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> { e.span, "range syntax is experimental"); } + ast::ExprBox(..) | ast::ExprUnary(ast::UnOp::UnUniq, _) => { + self.gate_feature("box_syntax", + e.span, + "box expression syntax is experimental in alpha release; \ + you can call `Box::new` instead."); + } _ => {} } visit::walk_expr(self, e); @@ -365,6 +372,11 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> { but at the end of a slice (e.g. \ `[0, ..xs, 0]` are experimental") } + ast::PatBox(..) => { + self.gate_feature("box_syntax", + pattern.span, + "box pattern syntax is experimental in alpha release"); + } _ => {} } visit::walk_pat(self, pattern) |
