Consolidate the `unboxed_closure_sugar` and `unboxed_closure` feature gates.
* `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,
("linkage", Active),
("struct_inherit", Removed),
("overloaded_calls", Active),
- ("unboxed_closure_sugar", Active),
("quad_precision_float", Removed),
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",
}
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>) {
// 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;
// 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.
// 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;
// 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> {
// 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> {
// 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;
// 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;
// except according to those terms.
struct One<A>;
+#![feature(unboxed_closures)]
fn foo(_: One()) //~ ERROR wrong number of type arguments
{}
// except according to those terms.
struct Three<A,B,C>;
+#![feature(unboxed_closures)]
fn foo(_: Three()) //~ ERROR wrong number of type arguments
{}
// except according to those terms.
struct Zero;
+#![feature(unboxed_closures)]
fn foo(_: Zero()) //~ ERROR wrong number of type arguments
{}
// 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) {}
// 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};
// except according to those terms.
#![allow(dead_code)]
-#![feature(unboxed_closures, unboxed_closure_sugar)]
+#![feature(unboxed_closures)]
// compile-flags:-g
// 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)]
// 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(());
// 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)
// 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};
// 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};
// 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};
// 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;
// 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;
// Test unboxed closure sugar used in object types.
#![allow(dead_code)]
+#![feature(unboxed_closures)]
struct Foo<T,U> {
t: T, u: U
// 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;