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
{}

0 commit comments

Comments
 (0)