]> git.lizzy.rs Git - rust.git/commitdiff
Added `box_syntax` feature gate; added to std and rustc crates for bootstrap.
authorFelix S. Klock II <pnkfelix@pnkfx.org>
Wed, 7 Jan 2015 14:15:34 +0000 (15:15 +0100)
committerFelix S. Klock II <pnkfelix@pnkfx.org>
Wed, 7 Jan 2015 23:41:43 +0000 (00:41 +0100)
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]

14 files changed:
src/liballoc/lib.rs
src/libcollections/lib.rs
src/liblog/lib.rs
src/libregex/lib.rs
src/librustc/lib.rs
src/librustc_trans/lib.rs
src/librustc_typeck/lib.rs
src/librustdoc/lib.rs
src/libserialize/lib.rs
src/libstd/lib.rs
src/libsyntax/feature_gate.rs
src/libsyntax/lib.rs
src/libterm/lib.rs
src/libtest/lib.rs

index ba6e89cdd768e5016ec408f43c7206e00fa41876..402a542a92b303785eaa1ee8d26685c5b6f593fe 100644 (file)
@@ -66,6 +66,7 @@
 #![no_std]
 #![allow(unknown_features)]
 #![feature(lang_items, unsafe_destructor)]
+#![feature(box_syntax)]
 
 #[macro_use]
 extern crate core;
index 6eab36d8844df9372b9e55c567500c007d912bf3..37bc37b84dfd849cf14f529ce64107ada84194c6 100644 (file)
@@ -24,6 +24,7 @@
 #![allow(unknown_features)]
 #![feature(unsafe_destructor, slicing_syntax)]
 #![feature(old_impl_check)]
+#![feature(box_syntax)]
 #![feature(unboxed_closures)]
 #![no_std]
 
index 08b01e956e1ac83c073524226f8ca2ef5200d41d..ca61e3d1655af1cbf10cdd6c50d4f9749d63c6cc 100644 (file)
        html_root_url = "http://doc.rust-lang.org/nightly/",
        html_playground_url = "http://play.rust-lang.org/")]
 #![feature(slicing_syntax)]
+#![feature(box_syntax)]
 #![deny(missing_docs)]
 
 extern crate regex;
index c039abc9aff2a8955134bfbcd8181f2a46b85ae9..bd93816a26d6bafa4e2b8bf10867f98c6999b7f1 100644 (file)
@@ -24,6 +24,7 @@
 
 #![allow(unknown_features)]
 #![feature(slicing_syntax)]
+#![feature(box_syntax)]
 #![deny(missing_docs)]
 
 #[cfg(test)]
index a3a041c2497c7a9fed075053374a2127f9e6929a..7b57544d9d15d4c998ec5a63d3899955cd735181 100644 (file)
@@ -25,6 +25,7 @@
 #![allow(unknown_features)]
 #![feature(quote)]
 #![feature(slicing_syntax, unsafe_destructor)]
+#![feature(box_syntax)]
 #![feature(rustc_diagnostic_macros)]
 #![feature(old_impl_check)]
 
index b6f90a4c2f52a9ac7420b588f9f3727051fb87eb..e5f8334049bd8135dcc7ec7d31a55e022d374eef 100644 (file)
@@ -24,6 +24,7 @@
 
 #![feature(quote)]
 #![feature(slicing_syntax, unsafe_destructor)]
+#![feature(box_syntax)]
 #![feature(rustc_diagnostic_macros)]
 
 extern crate arena;
index ae8731dfa476b1e4e20ab0c101f6826906d25b97..950b3e4da86c7ca9b4ff61ddfbabf53bc3227787 100644 (file)
@@ -73,6 +73,7 @@
 
 #![feature(quote)]
 #![feature(slicing_syntax, unsafe_destructor)]
+#![feature(box_syntax)]
 #![feature(rustc_diagnostic_macros)]
 #![allow(non_camel_case_types)]
 
index ee65ef0662305a7bf99a4a3cbd145400d8eea2f4..d71dd00dc853f266601c33aa617bd21888ba3ac8 100644 (file)
@@ -17,6 +17,7 @@
        html_root_url = "http://doc.rust-lang.org/nightly/",
        html_playground_url = "http://play.rust-lang.org/")]
 #![feature(slicing_syntax)]
+#![feature(box_syntax)]
 
 extern crate arena;
 extern crate getopts;
index 139170fc012cb59d869ab95f93cde444c84cd778..39a6471aac65bdb140e4a193fef6a086eb6f9c29 100644 (file)
@@ -24,6 +24,7 @@
        html_playground_url = "http://play.rust-lang.org/")]
 #![allow(unknown_features)]
 #![feature(slicing_syntax)]
+#![feature(box_syntax)]
 #![feature(old_impl_check)]
 #![cfg_attr(stage0, allow(unused_attributes))]
 
index eef5bdb60eeaae2fe7cc6f448c9739c8237b5165..d34f497bbea360cde46186ba7ac7daa24d577f47 100644 (file)
 #![feature(linkage, thread_local, asm)]
 #![feature(lang_items, unsafe_destructor)]
 #![feature(slicing_syntax, unboxed_closures)]
+#![feature(box_syntax)]
 #![feature(old_impl_check)]
 #![cfg_attr(stage0, allow(unused_attributes))]
 
index f10113254de04f82ad10802b91e2437d0456a53a..fbff5e16ef5f755b5da16798b72f32a888a32b18 100644 (file)
@@ -70,6 +70,7 @@
     ("associated_types", Accepted),
     ("visible_private_types", Active),
     ("slicing_syntax", Active),
+    ("box_syntax", Active),
 
     ("if_let", Accepted),
     ("while_let", Accepted),
@@ -343,6 +344,12 @@ fn visit_expr(&mut self, e: &ast::Expr) {
                                   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 @@ fn visit_pat(&mut self, pattern: &ast::Pat) {
                                    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)
index 9e14f9dd1eaae3a0209539edd8e1df3ecb43c0fe..b6516254dbfefeca7275fda118a9a015540d6ebd 100644 (file)
@@ -24,6 +24,7 @@
 
 #![allow(unknown_features)]
 #![feature(slicing_syntax)]
+#![feature(box_syntax)]
 #![feature(quote, unsafe_destructor)]
 
 extern crate arena;
index c953f591d805864b8993fd75d8095b915772fca6..8f486ea8c02be684d5392ce552dd5dc12d4427a4 100644 (file)
@@ -49,6 +49,7 @@
 
 #![allow(unknown_features)]
 #![feature(slicing_syntax)]
+#![feature(box_syntax)]
 #![deny(missing_docs)]
 
 #[macro_use] extern crate log;
index 68d06cc4dab6480ec62139050d0e7a39adc896b6..506a625beb6a4e47f34076614661e2141315651e 100644 (file)
@@ -31,6 +31,7 @@
        html_favicon_url = "http://www.rust-lang.org/favicon.ico",
        html_root_url = "http://doc.rust-lang.org/nightly/")]
 #![feature(asm, slicing_syntax)]
+#![feature(box_syntax)]
 
 extern crate getopts;
 extern crate regex;