rust/src/test/compile-fail/unboxed-closure-feature-gate.rs
Ariel Ben-Yehuda bd01175234 clarify the parenthetical notation stability error message
This also calls the right API, which e.g. prevents a suggestion
for #![feature(unboxed_closures)] on stable.

Fixes #26970
2015-07-28 19:21:24 +03:00

31 lines
878 B
Rust

// 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.
// Check that parenthetical notation is feature-gated except with the
// `Fn` traits.
use std::marker;
trait Foo<A> {
type Output;
fn dummy(&self, a: A) { }
}
fn main() {
let x: Box<Foo(isize)>;
//~^ ERROR parenthetical notation is only stable when used with `Fn`-family
// No errors with these:
let x: Box<Fn(isize)>;
let x: Box<FnMut(isize)>;
let x: Box<FnOnce(isize)>;
}