]> git.lizzy.rs Git - rust.git/commitdiff
Place parenthetical notation under the `unboxed_closure` feature-gate.
authorNiko Matsakis <niko@alum.mit.edu>
Sat, 15 Nov 2014 21:04:04 +0000 (16:04 -0500)
committerNiko Matsakis <niko@alum.mit.edu>
Tue, 18 Nov 2014 17:26:04 +0000 (12:26 -0500)
Consolidate the `unboxed_closure_sugar` and `unboxed_closure` feature gates.

25 files changed:
src/doc/reference.md
src/libsyntax/feature_gate.rs
src/test/compile-fail/borrowck-unboxed-closures.rs
src/test/compile-fail/issue-16939.rs
src/test/compile-fail/regionck-unboxed-closure-lifetimes.rs
src/test/compile-fail/unboxed-closure-sugar-default.rs
src/test/compile-fail/unboxed-closure-sugar-equiv.rs
src/test/compile-fail/unboxed-closure-sugar-nonexistent-trait.rs
src/test/compile-fail/unboxed-closure-sugar-region.rs
src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs
src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs
src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters.rs
src/test/compile-fail/unboxed-closure-sugar-wrong-trait.rs
src/test/compile-fail/unboxed-closures-fnmut-as-fn.rs
src/test/run-pass/closure-syntax.rs
src/test/run-pass/hrtb-parse.rs
src/test/run-pass/issue-18661.rs
src/test/run-pass/unboxed-closures-all-traits.rs
src/test/run-pass/unboxed-closures-extern-fn.rs
src/test/run-pass/unboxed-closures-fn-as-fnmut-and-fnonce.rs
src/test/run-pass/unboxed-closures-fnmut-as-fnonce.rs
src/test/run-pass/unboxed-closures-manual-impl.rs
src/test/run-pass/unboxed-closures-prelude.rs
src/test/run-pass/unboxed-closures-sugar-object.rs
src/test/run-pass/unboxed-closures-unboxing-shim.rs

index 171c39a4cbc3937ed276a90eb183186b9717af54..dcf3f9826c22f05d7e879e6613e964c7890a1d99 100644 (file)
@@ -2560,10 +2560,6 @@ The currently implemented features of the reference compiler are:
 * `trace_macros` - Allows use of the `trace_macros` macro, which is a nasty
                    hack that will certainly be removed.
 
-* `unboxed_closure_sugar` - Allows using `|Foo| -> Bar` as a trait bound
-                            meaning one of the `Fn` traits. Still
-                            experimental.
-
 * `unboxed_closures` - A work in progress feature with many known bugs.
 
 * `unsafe_destructor` - Allows use of the `#[unsafe_destructor]` attribute,
index 0c31e9ae01d757ef9d3eaade708c9574d7817dcd..a36a0fbc82621ec414af88433e8e38f4fd536b49 100644 (file)
@@ -59,7 +59,6 @@
     ("linkage", Active),
     ("struct_inherit", Removed),
     ("overloaded_calls", Active),
-    ("unboxed_closure_sugar", Active),
 
     ("quad_precision_float", Removed),
 
@@ -381,7 +380,7 @@ fn visit_fn(&mut self,
                 fn_decl: &'v ast::FnDecl,
                 block: &'v ast::Block,
                 span: Span,
-                _: NodeId) {
+                _node_id: NodeId) {
         match fn_kind {
             visit::FkItemFn(_, _, _, abi) if abi == RustIntrinsic => {
                 self.gate_feature("intrinsics",
@@ -392,6 +391,19 @@ fn visit_fn(&mut self,
         }
         visit::walk_fn(self, fn_kind, fn_decl, block, span);
     }
+
+    fn visit_path_parameters(&mut self, path_span: Span, parameters: &'v ast::PathParameters) {
+        match *parameters {
+            ast::ParenthesizedParameters(..) => {
+                self.gate_feature("unboxed_closures",
+                                  path_span,
+                                  "parenthetical parameter notation is subject to change");
+            }
+            ast::AngleBracketedParameters(..) => { }
+        }
+
+        visit::walk_path_parameters(self, path_span, parameters)
+    }
 }
 
 pub fn check_crate(span_handler: &SpanHandler, krate: &ast::Crate) -> (Features, Vec<Span>) {
index 5f9dd72f5bf148733a611321bb5d014d4d3abe5f..cca3dcb8b34dbd328bc55c36024785cdf4f77839 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(overloaded_calls)]
+#![feature(overloaded_calls, unboxed_closures)]
 
 fn a<F:Fn(int, int) -> int>(mut f: F) {
     let g = &mut f;
index e7d3d15e5a938893b2d5d32f06b66d656a94c830..7ec3fef5c878eb05a060356e60fa5b169b03392c 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(overloaded_calls)]
+#![feature(overloaded_calls, unboxed_closures)]
 
 // Make sure we don't ICE when making an overloaded call with the
 // wrong arity.
index e046b5c68addd4c88826cd13c583fae3327fcf71..75e9e55138e06a45a5bffa1068188d797b01e447 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(unboxed_closure_sugar, unboxed_closures, overloaded_calls)]
+#![feature(unboxed_closures, overloaded_calls)]
 
 use std::ops::FnMut;
 
index 9866a20004527f0520063f680bab36af044057f7..d015f8195c5351fff659ac1e3a2c6aca06fcbd6b 100644 (file)
@@ -11,7 +11,7 @@
 // Test interaction between unboxed closure sugar and default type
 // parameters (should be exactly as if angle brackets were used).
 
-#![feature(default_type_params)]
+#![feature(default_type_params, unboxed_closures)]
 #![allow(dead_code)]
 
 struct Foo<T,U,V=T> {
index c38010c1ee260a9bb5fcd610bf63d1dd2edc89b9..f858793b9ecc3a994424e2bd1a72e613fe0da52d 100644 (file)
@@ -13,6 +13,7 @@
 // angle brackets. This test covers only simple types and in
 // particular doesn't test bound regions.
 
+#![feature(unboxed_closures)]
 #![allow(dead_code)]
 
 struct Foo<T,U> {
index d89c3802508c593c653330580acb96d7635ee745..23e2d2f4365afdbe53039e2000c2bed0677b5f0f 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(unboxed_closures)]
+
 fn f<F:Nonexist(int) -> int>(x: F) {} //~ ERROR nonexistent trait `Nonexist`
 
 type Typedef = int;
index 962e233dea696651ee56bb33753ffc3d02db6423..9cef2d951bfeaa80d3c6b0f5c3d32c1c92e9f518 100644 (file)
@@ -12,7 +12,7 @@
 // parameters (should be exactly as if angle brackets were used
 // and regions omitted).
 
-#![feature(default_type_params)]
+#![feature(default_type_params, unboxed_closures)]
 #![allow(dead_code)]
 
 use std::kinds::marker;
index e122b87b1e0f04c9b4094d6a764ecb7434b1a9ca..5e3ebc70b864216a1e41131d934fb3e2d808d96b 100644 (file)
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 struct One<A>;
+#![feature(unboxed_closures)]
 
 fn foo(_: One()) //~ ERROR wrong number of type arguments
 {}
index 7a66abb39df58e1e01da72422c651e1ba6c86291..c34f55ed4f9e440aaae9742b078a32bf797166aa 100644 (file)
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 struct Three<A,B,C>;
+#![feature(unboxed_closures)]
 
 fn foo(_: Three()) //~ ERROR wrong number of type arguments
 {}
index e265a3d56b871cc56af5f340fbe1b9c7b10d8b62..f7ff53310b06c50643b8a87c50ace62d7ef28816 100644 (file)
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 struct Zero;
+#![feature(unboxed_closures)]
 
 fn foo(_: Zero()) //~ ERROR wrong number of type arguments
 {}
index 1394f8fa65fccb9cd0d07f08b4a0de2dd824d89b..ba1e931ac64344cdadc84e5c7af9ed97fda9466a 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(unboxed_closures)]
+
 trait Trait {}
 
 fn f<F:Trait(int) -> int>(x: F) {}
index 20d7262432f0c82de9c1d7e811a8fe03e1bf12d0..9fbb8a18ae93a4b55227bb292a33a3d4c5b918f3 100644 (file)
@@ -11,7 +11,7 @@
 // Checks that the Fn trait hierarchy rules do not permit
 // Fn to be used where FnMut is implemented.
 
-#![feature(unboxed_closure_sugar)]
+#![feature(unboxed_closures)]
 #![feature(overloaded_calls)]
 
 use std::ops::{Fn,FnMut,FnOnce};
index 9d98a7ac12f9ba1809d7845d3630ea3a3fde7ac9..6716c3468d0f84b67635c4fe94609021ffa2eb38 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 #![allow(dead_code)]
-#![feature(unboxed_closures, unboxed_closure_sugar)]
+#![feature(unboxed_closures)]
 
 // compile-flags:-g
 
index 080523f0060a7a3eed88fe8834a5eb1f4a2a67ac..02d3bc120da8c84a7ca5184678c34fa702dc3034 100644 (file)
@@ -11,6 +11,7 @@
 // Test that we can parse all the various places that a `for` keyword
 // can appear representing universal quantification.
 
+#![feature(unboxed_closures)]
 #![allow(unused_variables)]
 #![allow(dead_code)]
 
index 6a2f73a787a4835c1d54df7682cf467965d6a69e..6bade86fd3e42ecad11f83ae4c3c689dc7f26f8c 100644 (file)
@@ -11,7 +11,7 @@
 // Test that param substitutions from the correct environment are
 // used when translating unboxed closure calls.
 
-#![feature(unboxed_closures)]
+#![feature(unboxed_closures, unboxed_closures)]
 
 pub fn inside<F: Fn()>(c: F) {
     c.call(());
index 508d1e46f7e18e5e64588bbe47121f25ffc0e886..e8eeab3e4f34d2b2985745d3ecdceb83b310621a 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(lang_items, overloaded_calls, unboxed_closures)]
+#![feature(lang_items, overloaded_calls, unboxed_closures, unboxed_closures)]
 
 fn a<F:Fn(int, int) -> int>(f: F) -> int {
     f(1, 2)
index 82d51ba1f16456e5c120ea9efbba223e1220cd8a..516787ae570cb259fbb03ac10f136e1fd367f14d 100644 (file)
@@ -10,7 +10,7 @@
 
 // Checks that extern fn points implement the full range of Fn traits.
 
-#![feature(unboxed_closure_sugar)]
+#![feature(unboxed_closures)]
 #![feature(overloaded_calls)]
 
 use std::ops::{Fn,FnMut,FnOnce};
index 90272636bc59db86ba0e96517980a8c8a481dc8e..a62712b3a4ec0b24e39fad7d041b6cc7f272a4f9 100644 (file)
@@ -11,7 +11,7 @@
 // Checks that the Fn trait hierarchy rules permit
 // any Fn trait to be used where Fn is implemented.
 
-#![feature(unboxed_closure_sugar)]
+#![feature(unboxed_closures)]
 #![feature(overloaded_calls)]
 
 use std::ops::{Fn,FnMut,FnOnce};
index bd01910a210ab5f3b123eaf3ba6171d1453a9cdd..8e639d23aeb367e3fdff38a62897190629c2cfaf 100644 (file)
@@ -11,7 +11,7 @@
 // Checks that the Fn trait hierarchy rules permit
 // FnMut or FnOnce to be used where FnMut is implemented.
 
-#![feature(unboxed_closure_sugar)]
+#![feature(unboxed_closures)]
 #![feature(overloaded_calls)]
 
 use std::ops::{FnMut,FnOnce};
index 8f6cfe0499703ff7c7116c016bff80af6f060744..3a750dadb911c4ca2e30e7746798131b3e9f26b4 100644 (file)
@@ -9,7 +9,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(unboxed_closure_sugar)]
+#![feature(unboxed_closures)]
 
 use std::ops::FnMut;
 
index f9d2ba02123c464775abab2ca5f52acd0a3b96fa..6f672f2f2828c98fe8bf0182438b64405d11e7ff 100644 (file)
@@ -10,7 +10,7 @@
 
 // Tests that the reexports of `FnOnce` et al from the prelude work.
 
-#![feature(unboxed_closures, unboxed_closure_sugar)]
+#![feature(unboxed_closures)]
 
 fn main() {
     let task: Box<FnOnce(int) -> int> = box |: x| x;
index 3b38f72432f179c32e9a5320b2396afb5c19f2e7..d65de438514f5cdc1f0e8e1d0eaf437fc256084a 100644 (file)
@@ -11,6 +11,7 @@
 // Test unboxed closure sugar used in object types.
 
 #![allow(dead_code)]
+#![feature(unboxed_closures)]
 
 struct Foo<T,U> {
     t: T, u: U
index 426352cadd87fbcf05e312d65a439032a07c28dc..c41aeaa673f80cb87a230e63d85e8cfd3eadc376 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(unboxed_closures, unboxed_closure_sugar)]
+#![feature(unboxed_closures)]
 
 use std::ops::FnOnce;