mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 18:23:49 +00:00
Place parenthetical notation under the unboxed_closure
feature-gate.
Consolidate the `unboxed_closure_sugar` and `unboxed_closure` feature gates.
This commit is contained in:
parent
618bd5d1c5
commit
058abcc209
@ -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,
|
||||
|
@ -59,7 +59,6 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
|
||||
("linkage", Active),
|
||||
("struct_inherit", Removed),
|
||||
("overloaded_calls", Active),
|
||||
("unboxed_closure_sugar", Active),
|
||||
|
||||
("quad_precision_float", Removed),
|
||||
|
||||
@ -381,7 +380,7 @@ impl<'a, 'v> Visitor<'v> for Context<'a> {
|
||||
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 @@ impl<'a, 'v> Visitor<'v> for Context<'a> {
|
||||
}
|
||||
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>) {
|
||||
|
@ -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;
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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> {
|
||||
|
@ -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> {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -9,6 +9,7 @@
|
||||
// except according to those terms.
|
||||
|
||||
struct One<A>;
|
||||
#![feature(unboxed_closures)]
|
||||
|
||||
fn foo(_: One()) //~ ERROR wrong number of type arguments
|
||||
{}
|
||||
|
@ -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
|
||||
{}
|
||||
|
@ -9,6 +9,7 @@
|
||||
// except according to those terms.
|
||||
|
||||
struct Zero;
|
||||
#![feature(unboxed_closures)]
|
||||
|
||||
fn foo(_: Zero()) //~ ERROR wrong number of type arguments
|
||||
{}
|
||||
|
@ -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) {}
|
||||
|
@ -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};
|
||||
|
@ -9,7 +9,7 @@
|
||||
// except according to those terms.
|
||||
|
||||
#![allow(dead_code)]
|
||||
#![feature(unboxed_closures, unboxed_closure_sugar)]
|
||||
#![feature(unboxed_closures)]
|
||||
|
||||
// compile-flags:-g
|
||||
|
||||
|
@ -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)]
|
||||
|
||||
|
@ -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(());
|
||||
|
@ -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)
|
||||
|
@ -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};
|
||||
|
@ -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};
|
||||
|
@ -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};
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user