auto merge of #20869 : nikomatsakis/rust/issue-18875, r=huonw

Feature-gate `<>` syntax used with `Fn`. Fixes #18875.

r? @huonw
This commit is contained in:
bors 2015-01-10 16:20:04 +00:00
commit 099b411e08
5 changed files with 41 additions and 5 deletions

View file

@ -11,15 +11,15 @@
#![allow(dead_code)]
struct Foo;
impl Fn<(), ()> for Foo { //~ ERROR manual implementations of `Fn` are experimental
impl Fn() for Foo { //~ ERROR manual implementations of `Fn` are experimental
extern "rust-call" fn call(&self, args: ()) -> () {}
}
struct Bar;
impl FnMut<(), ()> for Bar { //~ ERROR manual implementations of `FnMut` are experimental
impl FnMut() for Bar { //~ ERROR manual implementations of `FnMut` are experimental
extern "rust-call" fn call_mut(&self, args: ()) -> () {}
}
struct Baz;
impl FnOnce<(), ()> for Baz { //~ ERROR manual implementations of `FnOnce` are experimental
impl FnOnce() for Baz { //~ ERROR manual implementations of `FnOnce` are experimental
extern "rust-call" fn call_once(&self, args: ()) -> () {}
}

View file

@ -10,7 +10,7 @@
#![allow(dead_code)]
fn foo<F: Fn<(), ()>>(mut f: F) {
fn foo<F: Fn()>(mut f: F) {
f.call(()); //~ ERROR explicit use of unboxed closure method `call`
f.call_mut(()); //~ ERROR explicit use of unboxed closure method `call_mut`
f.call_once(()); //~ ERROR explicit use of unboxed closure method `call_once`

View file

@ -10,7 +10,7 @@
#![allow(dead_code)]
fn foo<F: Fn<(), ()>>(mut f: F, mut g: F) {
fn foo<F: Fn()>(mut f: F, mut g: F) {
Fn::call(&g, ()); //~ ERROR explicit use of unboxed closure method `call`
FnMut::call_mut(&mut g, ()); //~ ERROR explicit use of unboxed closure method `call_mut`
FnOnce::call_once(g, ()); //~ ERROR explicit use of unboxed closure method `call_once`

View file

@ -0,0 +1,23 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Test that the `Fn` traits require `()` form without a feature gate.
fn bar1(x: &Fn<(),()>) {
//~^ ERROR angle-bracket notation is not stable when used with the `Fn` family
}
fn bar2<T>(x: &T) where T: Fn<(),()> {
//~^ ERROR angle-bracket notation is not stable when used with the `Fn` family
}
fn main() { }