Skip to content

Commit 058abcc

Browse files
committed
Place parenthetical notation under the unboxed_closure feature-gate.
Consolidate the `unboxed_closure_sugar` and `unboxed_closure` feature gates.
1 parent 618bd5d commit 058abcc

25 files changed

+39
-21
lines changed

src/doc/reference.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2560,10 +2560,6 @@ The currently implemented features of the reference compiler are:
25602560
* `trace_macros` - Allows use of the `trace_macros` macro, which is a nasty
25612561
hack that will certainly be removed.
25622562

2563-
* `unboxed_closure_sugar` - Allows using `|Foo| -> Bar` as a trait bound
2564-
meaning one of the `Fn` traits. Still
2565-
experimental.
2566-
25672563
* `unboxed_closures` - A work in progress feature with many known bugs.
25682564

25692565
* `unsafe_destructor` - Allows use of the `#[unsafe_destructor]` attribute,

src/libsyntax/feature_gate.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
5959
("linkage", Active),
6060
("struct_inherit", Removed),
6161
("overloaded_calls", Active),
62-
("unboxed_closure_sugar", Active),
6362

6463
("quad_precision_float", Removed),
6564

@@ -381,7 +380,7 @@ impl<'a, 'v> Visitor<'v> for Context<'a> {
381380
fn_decl: &'v ast::FnDecl,
382381
block: &'v ast::Block,
383382
span: Span,
384-
_: NodeId) {
383+
_node_id: NodeId) {
385384
match fn_kind {
386385
visit::FkItemFn(_, _, _, abi) if abi == RustIntrinsic => {
387386
self.gate_feature("intrinsics",
@@ -392,6 +391,19 @@ impl<'a, 'v> Visitor<'v> for Context<'a> {
392391
}
393392
visit::walk_fn(self, fn_kind, fn_decl, block, span);
394393
}
394+
395+
fn visit_path_parameters(&mut self, path_span: Span, parameters: &'v ast::PathParameters) {
396+
match *parameters {
397+
ast::ParenthesizedParameters(..) => {
398+
self.gate_feature("unboxed_closures",
399+
path_span,
400+
"parenthetical parameter notation is subject to change");
401+
}
402+
ast::AngleBracketedParameters(..) => { }
403+
}
404+
405+
visit::walk_path_parameters(self, path_span, parameters)
406+
}
395407
}
396408

397409
pub fn check_crate(span_handler: &SpanHandler, krate: &ast::Crate) -> (Features, Vec<Span>) {

src/test/compile-fail/borrowck-unboxed-closures.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(overloaded_calls)]
11+
#![feature(overloaded_calls, unboxed_closures)]
1212

1313
fn a<F:Fn(int, int) -> int>(mut f: F) {
1414
let g = &mut f;

src/test/compile-fail/issue-16939.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(overloaded_calls)]
11+
#![feature(overloaded_calls, unboxed_closures)]
1212

1313
// Make sure we don't ICE when making an overloaded call with the
1414
// wrong arity.

src/test/compile-fail/regionck-unboxed-closure-lifetimes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(unboxed_closure_sugar, unboxed_closures, overloaded_calls)]
11+
#![feature(unboxed_closures, overloaded_calls)]
1212

1313
use std::ops::FnMut;
1414

src/test/compile-fail/unboxed-closure-sugar-default.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// Test interaction between unboxed closure sugar and default type
1212
// parameters (should be exactly as if angle brackets were used).
1313

14-
#![feature(default_type_params)]
14+
#![feature(default_type_params, unboxed_closures)]
1515
#![allow(dead_code)]
1616

1717
struct Foo<T,U,V=T> {

src/test/compile-fail/unboxed-closure-sugar-equiv.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// angle brackets. This test covers only simple types and in
1414
// particular doesn't test bound regions.
1515

16+
#![feature(unboxed_closures)]
1617
#![allow(dead_code)]
1718

1819
struct Foo<T,U> {

src/test/compile-fail/unboxed-closure-sugar-nonexistent-trait.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![feature(unboxed_closures)]
12+
1113
fn f<F:Nonexist(int) -> int>(x: F) {} //~ ERROR nonexistent trait `Nonexist`
1214

1315
type Typedef = int;

src/test/compile-fail/unboxed-closure-sugar-region.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// parameters (should be exactly as if angle brackets were used
1313
// and regions omitted).
1414

15-
#![feature(default_type_params)]
15+
#![feature(default_type_params, unboxed_closures)]
1616
#![allow(dead_code)]
1717

1818
use std::kinds::marker;

src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
struct One<A>;
12+
#![feature(unboxed_closures)]
1213

1314
fn foo(_: One()) //~ ERROR wrong number of type arguments
1415
{}

src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
struct Three<A,B,C>;
12+
#![feature(unboxed_closures)]
1213

1314
fn foo(_: Three()) //~ ERROR wrong number of type arguments
1415
{}

src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
struct Zero;
12+
#![feature(unboxed_closures)]
1213

1314
fn foo(_: Zero()) //~ ERROR wrong number of type arguments
1415
{}

src/test/compile-fail/unboxed-closure-sugar-wrong-trait.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![feature(unboxed_closures)]
12+
1113
trait Trait {}
1214

1315
fn f<F:Trait(int) -> int>(x: F) {}

src/test/compile-fail/unboxed-closures-fnmut-as-fn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// Checks that the Fn trait hierarchy rules do not permit
1212
// Fn to be used where FnMut is implemented.
1313

14-
#![feature(unboxed_closure_sugar)]
14+
#![feature(unboxed_closures)]
1515
#![feature(overloaded_calls)]
1616

1717
use std::ops::{Fn,FnMut,FnOnce};

src/test/run-pass/closure-syntax.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
#![allow(dead_code)]
12-
#![feature(unboxed_closures, unboxed_closure_sugar)]
12+
#![feature(unboxed_closures)]
1313

1414
// compile-flags:-g
1515

src/test/run-pass/hrtb-parse.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
// Test that we can parse all the various places that a `for` keyword
1212
// can appear representing universal quantification.
1313

14+
#![feature(unboxed_closures)]
1415
#![allow(unused_variables)]
1516
#![allow(dead_code)]
1617

src/test/run-pass/issue-18661.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// Test that param substitutions from the correct environment are
1212
// used when translating unboxed closure calls.
1313

14-
#![feature(unboxed_closures)]
14+
#![feature(unboxed_closures, unboxed_closures)]
1515

1616
pub fn inside<F: Fn()>(c: F) {
1717
c.call(());

src/test/run-pass/unboxed-closures-all-traits.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(lang_items, overloaded_calls, unboxed_closures)]
11+
#![feature(lang_items, overloaded_calls, unboxed_closures, unboxed_closures)]
1212

1313
fn a<F:Fn(int, int) -> int>(f: F) -> int {
1414
f(1, 2)

src/test/run-pass/unboxed-closures-extern-fn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// Checks that extern fn points implement the full range of Fn traits.
1212

13-
#![feature(unboxed_closure_sugar)]
13+
#![feature(unboxed_closures)]
1414
#![feature(overloaded_calls)]
1515

1616
use std::ops::{Fn,FnMut,FnOnce};

src/test/run-pass/unboxed-closures-fn-as-fnmut-and-fnonce.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// Checks that the Fn trait hierarchy rules permit
1212
// any Fn trait to be used where Fn is implemented.
1313

14-
#![feature(unboxed_closure_sugar)]
14+
#![feature(unboxed_closures)]
1515
#![feature(overloaded_calls)]
1616

1717
use std::ops::{Fn,FnMut,FnOnce};

src/test/run-pass/unboxed-closures-fnmut-as-fnonce.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// Checks that the Fn trait hierarchy rules permit
1212
// FnMut or FnOnce to be used where FnMut is implemented.
1313

14-
#![feature(unboxed_closure_sugar)]
14+
#![feature(unboxed_closures)]
1515
#![feature(overloaded_calls)]
1616

1717
use std::ops::{FnMut,FnOnce};

src/test/run-pass/unboxed-closures-manual-impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// option. This file may not be copied, modified, or distributed
1010
// except according to those terms.
1111

12-
#![feature(unboxed_closure_sugar)]
12+
#![feature(unboxed_closures)]
1313

1414
use std::ops::FnMut;
1515

src/test/run-pass/unboxed-closures-prelude.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// Tests that the reexports of `FnOnce` et al from the prelude work.
1212

13-
#![feature(unboxed_closures, unboxed_closure_sugar)]
13+
#![feature(unboxed_closures)]
1414

1515
fn main() {
1616
let task: Box<FnOnce(int) -> int> = box |: x| x;

src/test/run-pass/unboxed-closures-sugar-object.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
// Test unboxed closure sugar used in object types.
1212

1313
#![allow(dead_code)]
14+
#![feature(unboxed_closures)]
1415

1516
struct Foo<T,U> {
1617
t: T, u: U

src/test/run-pass/unboxed-closures-unboxing-shim.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(unboxed_closures, unboxed_closure_sugar)]
11+
#![feature(unboxed_closures)]
1212

1313
use std::ops::FnOnce;
1414

0 commit comments

Comments
 (0)