mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-26 05:44:26 +00:00
Don't gate methods Fn(Mut,Once)::call(mut,once)
with feature unboxed_closures
They are already gated with feature `fn_traits`
This commit is contained in:
parent
724f811794
commit
a80d329b68
@ -49,7 +49,6 @@
|
|||||||
#![feature(specialization)]
|
#![feature(specialization)]
|
||||||
#![feature(staged_api)]
|
#![feature(staged_api)]
|
||||||
#![feature(step_by)]
|
#![feature(step_by)]
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
#![feature(unicode)]
|
#![feature(unicode)]
|
||||||
#![feature(unique)]
|
#![feature(unique)]
|
||||||
#![feature(unsafe_no_drop_flag)]
|
#![feature(unsafe_no_drop_flag)]
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
#![feature(step_by)]
|
#![feature(step_by)]
|
||||||
#![feature(test)]
|
#![feature(test)]
|
||||||
#![feature(try_from)]
|
#![feature(try_from)]
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
#![feature(unicode)]
|
#![feature(unicode)]
|
||||||
#![feature(unique)]
|
#![feature(unique)]
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
#![feature(set_stdio)]
|
#![feature(set_stdio)]
|
||||||
#![feature(staged_api)]
|
#![feature(staged_api)]
|
||||||
#![feature(question_mark)]
|
#![feature(question_mark)]
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
extern crate arena;
|
extern crate arena;
|
||||||
extern crate flate;
|
extern crate flate;
|
||||||
|
@ -27,33 +27,8 @@ use rustc::hir;
|
|||||||
/// to `trait_id` (this only cares about the trait, not the specific
|
/// to `trait_id` (this only cares about the trait, not the specific
|
||||||
/// method that is called)
|
/// method that is called)
|
||||||
pub fn check_legal_trait_for_method_call(ccx: &CrateCtxt, span: Span, trait_id: DefId) {
|
pub fn check_legal_trait_for_method_call(ccx: &CrateCtxt, span: Span, trait_id: DefId) {
|
||||||
let tcx = ccx.tcx;
|
if ccx.tcx.lang_items.drop_trait() == Some(trait_id) {
|
||||||
let did = Some(trait_id);
|
span_err!(ccx.tcx.sess, span, E0040, "explicit use of destructor method");
|
||||||
let li = &tcx.lang_items;
|
|
||||||
|
|
||||||
if did == li.drop_trait() {
|
|
||||||
span_err!(tcx.sess, span, E0040, "explicit use of destructor method");
|
|
||||||
} else if !tcx.sess.features.borrow().unboxed_closures {
|
|
||||||
// the #[feature(unboxed_closures)] feature isn't
|
|
||||||
// activated so we need to enforce the closure
|
|
||||||
// restrictions.
|
|
||||||
|
|
||||||
let method = if did == li.fn_trait() {
|
|
||||||
"call"
|
|
||||||
} else if did == li.fn_mut_trait() {
|
|
||||||
"call_mut"
|
|
||||||
} else if did == li.fn_once_trait() {
|
|
||||||
"call_once"
|
|
||||||
} else {
|
|
||||||
return // not a closure method, everything is OK.
|
|
||||||
};
|
|
||||||
|
|
||||||
struct_span_err!(tcx.sess, span, E0174,
|
|
||||||
"explicit use of unboxed closure method `{}` is experimental",
|
|
||||||
method)
|
|
||||||
.help("add `#![feature(unboxed_closures)]` to the crate \
|
|
||||||
attributes to enable")
|
|
||||||
.emit();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1944,89 +1944,6 @@ To learn more about traits, take a look at the Book:
|
|||||||
https://doc.rust-lang.org/book/traits.html
|
https://doc.rust-lang.org/book/traits.html
|
||||||
"##,
|
"##,
|
||||||
|
|
||||||
E0174: r##"
|
|
||||||
This error occurs because of the explicit use of unboxed closure methods
|
|
||||||
that are an experimental feature in current Rust version.
|
|
||||||
|
|
||||||
Example of erroneous code:
|
|
||||||
|
|
||||||
```compile_fail
|
|
||||||
fn foo<F: Fn(&str)>(mut f: F) {
|
|
||||||
f.call(("call",));
|
|
||||||
// error: explicit use of unboxed closure method `call`
|
|
||||||
f.call_mut(("call_mut",));
|
|
||||||
// error: explicit use of unboxed closure method `call_mut`
|
|
||||||
f.call_once(("call_once",));
|
|
||||||
// error: explicit use of unboxed closure method `call_once`
|
|
||||||
}
|
|
||||||
|
|
||||||
fn bar(text: &str) {
|
|
||||||
println!("Calling {} it works!", text);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
foo(bar);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Rust's implementation of closures is a bit different than other languages.
|
|
||||||
They are effectively syntax sugar for traits `Fn`, `FnMut` and `FnOnce`.
|
|
||||||
To understand better how the closures are implemented see here:
|
|
||||||
https://doc.rust-lang.org/book/closures.html#closure-implementation
|
|
||||||
|
|
||||||
To fix this you can call them using parenthesis, like this: `foo()`.
|
|
||||||
When you execute the closure with parenthesis, under the hood you are executing
|
|
||||||
the method `call`, `call_mut` or `call_once`. However, using them explicitly is
|
|
||||||
currently an experimental feature.
|
|
||||||
|
|
||||||
Example of an implicit call:
|
|
||||||
|
|
||||||
```
|
|
||||||
fn foo<F: Fn(&str)>(f: F) {
|
|
||||||
f("using ()"); // Calling using () it works!
|
|
||||||
}
|
|
||||||
|
|
||||||
fn bar(text: &str) {
|
|
||||||
println!("Calling {} it works!", text);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
foo(bar);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
To enable the explicit calls you need to add `#![feature(unboxed_closures)]`.
|
|
||||||
|
|
||||||
This feature is still unstable so you will also need to add
|
|
||||||
`#![feature(fn_traits)]`.
|
|
||||||
More details about this issue here:
|
|
||||||
https://github.com/rust-lang/rust/issues/29625
|
|
||||||
|
|
||||||
Example of use:
|
|
||||||
|
|
||||||
```
|
|
||||||
#![feature(fn_traits)]
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
fn foo<F: Fn(&str)>(mut f: F) {
|
|
||||||
f.call(("call",)); // Calling 'call' it works!
|
|
||||||
f.call_mut(("call_mut",)); // Calling 'call_mut' it works!
|
|
||||||
f.call_once(("call_once",)); // Calling 'call_once' it works!
|
|
||||||
}
|
|
||||||
|
|
||||||
fn bar(text: &str) {
|
|
||||||
println!("Calling '{}' it works!", text);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
foo(bar);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
To see more about closures take a look here:
|
|
||||||
https://doc.rust-lang.org/book/closures.html`
|
|
||||||
"##,
|
|
||||||
|
|
||||||
E0178: r##"
|
E0178: r##"
|
||||||
In types, the `+` type operator has low precedence, so it is often necessary
|
In types, the `+` type operator has low precedence, so it is often necessary
|
||||||
to use parentheses.
|
to use parentheses.
|
||||||
@ -4049,6 +3966,7 @@ register_diagnostics! {
|
|||||||
E0167,
|
E0167,
|
||||||
// E0168,
|
// E0168,
|
||||||
// E0173, // manual implementations of unboxed closure traits are experimental
|
// E0173, // manual implementations of unboxed closure traits are experimental
|
||||||
|
// E0174,
|
||||||
E0182,
|
E0182,
|
||||||
E0183,
|
E0183,
|
||||||
// E0187, // can't infer the kind of the closure
|
// E0187, // can't infer the kind of the closure
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
|
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
#![feature(rustc_attrs)]
|
#![feature(rustc_attrs)]
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
#![deny(hr_lifetime_in_assoc_type)]
|
#![deny(hr_lifetime_in_assoc_type)]
|
||||||
|
|
||||||
trait Foo<'a> {
|
trait Foo<'a> {
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
#![allow(dead_code, unused_variables)]
|
#![allow(dead_code, unused_variables)]
|
||||||
#![deny(hr_lifetime_in_assoc_type)]
|
#![deny(hr_lifetime_in_assoc_type)]
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
use std::str::Chars;
|
use std::str::Chars;
|
||||||
|
|
||||||
|
@ -10,8 +10,6 @@
|
|||||||
|
|
||||||
// Ensure that invoking a closure counts as a unique immutable borrow
|
// Ensure that invoking a closure counts as a unique immutable borrow
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
type Fn<'a> = Box<FnMut() + 'a>;
|
type Fn<'a> = Box<FnMut() + 'a>;
|
||||||
|
|
||||||
struct Test<'a> {
|
struct Test<'a> {
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(overloaded_calls, unboxed_closures)]
|
|
||||||
|
|
||||||
fn a<F:Fn(isize, isize) -> isize>(mut f: F) {
|
fn a<F:Fn(isize, isize) -> isize>(mut f: F) {
|
||||||
let g = &mut f;
|
let g = &mut f;
|
||||||
f(1, 2); //~ ERROR cannot borrow `f` as immutable
|
f(1, 2); //~ ERROR cannot borrow `f` as immutable
|
||||||
|
@ -11,9 +11,9 @@
|
|||||||
#![allow(dead_code)]
|
#![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(()); //~ ERROR use of unstable library feature 'fn_traits'
|
||||||
f.call_mut(()); //~ ERROR explicit use of unboxed closure method `call_mut`
|
f.call_mut(()); //~ ERROR use of unstable library feature 'fn_traits'
|
||||||
f.call_once(()); //~ ERROR explicit use of unboxed closure method `call_once`
|
f.call_once(()); //~ ERROR use of unstable library feature 'fn_traits'
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -10,10 +10,10 @@
|
|||||||
|
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
fn foo<F: Fn()>(mut f: F, mut g: F) {
|
fn foo<F: Fn()>(mut f: F) {
|
||||||
Fn::call(&g, ()); //~ ERROR explicit use of unboxed closure method `call`
|
Fn::call(&f, ()); //~ ERROR use of unstable library feature 'fn_traits'
|
||||||
FnMut::call_mut(&mut g, ()); //~ ERROR explicit use of unboxed closure method `call_mut`
|
FnMut::call_mut(&mut f, ()); //~ ERROR use of unstable library feature 'fn_traits'
|
||||||
FnOnce::call_once(g, ()); //~ ERROR explicit use of unboxed closure method `call_once`
|
FnOnce::call_once(f, ()); //~ ERROR use of unstable library feature 'fn_traits'
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
|
|
||||||
fn needs_fn<F>(x: F) where F: Fn(isize) -> isize {}
|
fn needs_fn<F>(x: F) where F: Fn(isize) -> isize {}
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(overloaded_calls, unboxed_closures)]
|
|
||||||
|
|
||||||
// Make sure we don't ICE when making an overloaded call with the
|
// Make sure we don't ICE when making an overloaded call with the
|
||||||
// wrong arity.
|
// wrong arity.
|
||||||
|
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(overloaded_calls)]
|
|
||||||
|
|
||||||
fn f<'r>(p: &'r mut fn(p: &mut ())) {
|
fn f<'r>(p: &'r mut fn(p: &mut ())) {
|
||||||
(*p)(()) //~ ERROR mismatched types
|
(*p)(()) //~ ERROR mismatched types
|
||||||
//~| expected type `&mut ()`
|
//~| expected type `&mut ()`
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
pub fn foo<'a, F: Fn(&'a ())>(bar: F) {
|
pub fn foo<'a, F: Fn(&'a ())>(bar: F) {
|
||||||
bar.call((
|
bar.call((
|
||||||
&(), //~ ERROR borrowed value does not live long enough
|
&(), //~ ERROR borrowed value does not live long enough
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
use std::marker;
|
use std::marker;
|
||||||
|
|
||||||
struct B<T>(marker::PhantomData<T>);
|
struct B<T>(marker::PhantomData<T>);
|
||||||
|
@ -12,8 +12,6 @@
|
|||||||
// when a type error or unconstrained type variable propagates
|
// when a type error or unconstrained type variable propagates
|
||||||
// into it.
|
// into it.
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
(return)((),());
|
(return)((),());
|
||||||
//~^ ERROR the type of this value must be known
|
//~^ ERROR the type of this value must be known
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
"".homura()(); //~ ERROR no method named `homura` found
|
"".homura()(); //~ ERROR no method named `homura` found
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
type foo = fn(&u8, &u8) -> &u8; //~ ERROR missing lifetime specifier
|
type foo = fn(&u8, &u8) -> &u8; //~ ERROR missing lifetime specifier
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
fn id<T>(t: T) -> T { t }
|
fn id<T>(t: T) -> T { t }
|
||||||
|
|
||||||
fn f<'r, T>(v: &'r T) -> Box<FnMut() -> T + 'r> {
|
fn f<'r, T>(v: &'r T) -> Box<FnMut() -> T + 'r> {
|
||||||
|
@ -12,8 +12,6 @@
|
|||||||
// bound must be noncopyable. For details see
|
// bound must be noncopyable. For details see
|
||||||
// http://smallcultfollowing.com/babysteps/blog/2013/04/30/the-case-of-the-recurring-closure/
|
// http://smallcultfollowing.com/babysteps/blog/2013/04/30/the-case-of-the-recurring-closure/
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
struct R<'a> {
|
struct R<'a> {
|
||||||
// This struct is needed to create the
|
// This struct is needed to create the
|
||||||
// otherwise infinite type of a fn that
|
// otherwise infinite type of a fn that
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(unboxed_closures, overloaded_calls)]
|
|
||||||
|
|
||||||
use std::ops::FnMut;
|
use std::ops::FnMut;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
fn with_int(f: &mut FnMut(&isize)) {
|
fn with_int(f: &mut FnMut(&isize)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,8 +10,6 @@
|
|||||||
|
|
||||||
// Test that closures cannot subvert aliasing restrictions
|
// Test that closures cannot subvert aliasing restrictions
|
||||||
|
|
||||||
#![feature(overloaded_calls, unboxed_closures)]
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// Unboxed closure case
|
// Unboxed closure case
|
||||||
{
|
{
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
struct closure_box<'a> {
|
struct closure_box<'a> {
|
||||||
cl: Box<FnMut() + 'a>,
|
cl: Box<FnMut() + 'a>,
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
// Test that even unboxed closures that are capable of mutating their
|
// Test that even unboxed closures that are capable of mutating their
|
||||||
// environment cannot mutate captured variables that have not been
|
// environment cannot mutate captured variables that have not been
|
||||||
// declared mutable (#18335)
|
// declared mutable (#18335)
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
// Test that an unboxed closure that captures a free variable by
|
// Test that an unboxed closure that captures a free variable by
|
||||||
// reference cannot escape the region of that variable.
|
// reference cannot escape the region of that variable.
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
fn f<F:Nonexist(isize) -> isize>(x: F) {} //~ ERROR trait `Nonexist` is not in scope
|
fn f<F:Nonexist(isize) -> isize>(x: F) {} //~ ERROR trait `Nonexist` is not in scope
|
||||||
|
|
||||||
type Typedef = isize;
|
type Typedef = isize;
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
// Test that an unboxed closure that mutates a free variable will
|
// Test that an unboxed closure that mutates a free variable will
|
||||||
// cause borrow conflicts.
|
// cause borrow conflicts.
|
||||||
|
|
||||||
|
@ -11,8 +11,6 @@
|
|||||||
// That a closure whose expected argument types include two distinct
|
// That a closure whose expected argument types include two distinct
|
||||||
// bound regions.
|
// bound regions.
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
|
|
||||||
fn doit<T,F>(val: T, f: &F)
|
fn doit<T,F>(val: T, f: &F)
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut zero = || {};
|
let mut zero = || {};
|
||||||
let () = zero.call_mut(());
|
let () = zero.call_mut(());
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
use std::ops::FnMut;
|
use std::ops::FnMut;
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
|
@ -10,8 +10,6 @@
|
|||||||
|
|
||||||
// Tests that unsafe extern fn pointers do not implement any Fn traits.
|
// Tests that unsafe extern fn pointers do not implement any Fn traits.
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
use std::ops::{Fn,FnMut,FnOnce};
|
use std::ops::{Fn,FnMut,FnOnce};
|
||||||
|
|
||||||
unsafe fn square(x: &isize) -> isize { (*x) * (*x) }
|
unsafe fn square(x: &isize) -> isize { (*x) * (*x) }
|
||||||
|
@ -10,8 +10,6 @@
|
|||||||
|
|
||||||
// Tests that unsafe extern fn pointers do not implement any Fn traits.
|
// Tests that unsafe extern fn pointers do not implement any Fn traits.
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
use std::ops::{Fn,FnMut,FnOnce};
|
use std::ops::{Fn,FnMut,FnOnce};
|
||||||
|
|
||||||
extern "C" fn square(x: &isize) -> isize { (*x) * (*x) }
|
extern "C" fn square(x: &isize) -> isize { (*x) * (*x) }
|
||||||
|
@ -10,8 +10,6 @@
|
|||||||
|
|
||||||
// Tests that unsafe extern fn pointers do not implement any Fn traits.
|
// Tests that unsafe extern fn pointers do not implement any Fn traits.
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
use std::ops::{Fn,FnMut,FnOnce};
|
use std::ops::{Fn,FnMut,FnOnce};
|
||||||
|
|
||||||
unsafe fn square(x: isize) -> isize { x * x }
|
unsafe fn square(x: isize) -> isize { x * x }
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
// lldb-check:[...]$2 = 5
|
// lldb-check:[...]$2 = 5
|
||||||
|
|
||||||
#![allow(unused_variables)]
|
#![allow(unused_variables)]
|
||||||
#![feature(unboxed_closures, box_syntax)]
|
#![feature(box_syntax)]
|
||||||
#![feature(omit_gdb_pretty_printer_section)]
|
#![feature(omit_gdb_pretty_printer_section)]
|
||||||
#![omit_gdb_pretty_printer_section]
|
#![omit_gdb_pretty_printer_section]
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
// lldb-command:print *owned
|
// lldb-command:print *owned
|
||||||
// lldb-check:[...]$9 = 6
|
// lldb-check:[...]$9 = 6
|
||||||
|
|
||||||
#![feature(unboxed_closures, box_syntax)]
|
#![feature(box_syntax)]
|
||||||
#![allow(unused_variables)]
|
#![allow(unused_variables)]
|
||||||
#![feature(omit_gdb_pretty_printer_section)]
|
#![feature(omit_gdb_pretty_printer_section)]
|
||||||
#![omit_gdb_pretty_printer_section]
|
#![omit_gdb_pretty_printer_section]
|
||||||
|
@ -12,9 +12,6 @@
|
|||||||
// making method calls, but only if there aren't any matches without
|
// making method calls, but only if there aren't any matches without
|
||||||
// it.
|
// it.
|
||||||
|
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
trait iterable<A> {
|
trait iterable<A> {
|
||||||
fn iterate<F>(&self, blk: F) -> bool where F: FnMut(&A) -> bool;
|
fn iterate<F>(&self, blk: F) -> bool where F: FnMut(&A) -> bool;
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
// for `ByRef`. The right answer was to consider the result ambiguous
|
// for `ByRef`. The right answer was to consider the result ambiguous
|
||||||
// until more type information was available.
|
// until more type information was available.
|
||||||
|
|
||||||
#![feature(lang_items, unboxed_closures)]
|
#![feature(lang_items)]
|
||||||
#![no_implicit_prelude]
|
#![no_implicit_prelude]
|
||||||
|
|
||||||
use std::marker::Sized;
|
use std::marker::Sized;
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
// for `ByRef`. The right answer was to consider the result ambiguous
|
// for `ByRef`. The right answer was to consider the result ambiguous
|
||||||
// until more type information was available.
|
// until more type information was available.
|
||||||
|
|
||||||
#![feature(lang_items, unboxed_closures)]
|
#![feature(lang_items)]
|
||||||
#![no_implicit_prelude]
|
#![no_implicit_prelude]
|
||||||
|
|
||||||
use std::marker::Sized;
|
use std::marker::Sized;
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
#![crate_type = "rlib"]
|
#![crate_type = "rlib"]
|
||||||
|
|
||||||
pub fn inner<F>(f: F) -> F {
|
pub fn inner<F>(f: F) -> F {
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
use std::ops::Add;
|
use std::ops::Add;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
use std::ops::FnMut;
|
use std::ops::FnMut;
|
||||||
|
|
||||||
fn call_f<F:FnMut()>(mut f: F) {
|
fn call_f<F:FnMut()>(mut f: F) {
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
#![allow(unknown_features)]
|
#![allow(unknown_features)]
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let bar: Box<_> = box 3;
|
let bar: Box<_> = box 3;
|
||||||
|
@ -8,9 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
fn each<'a,T,F:FnMut(&'a T)>(x: &'a [T], mut f: F) {
|
fn each<'a,T,F:FnMut(&'a T)>(x: &'a [T], mut f: F) {
|
||||||
for val in x {
|
for val in x {
|
||||||
f(val)
|
f(val)
|
||||||
|
@ -10,8 +10,6 @@
|
|||||||
|
|
||||||
// pretty-expanded FIXME #23616
|
// pretty-expanded FIXME #23616
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
use std::sync::mpsc::channel;
|
use std::sync::mpsc::channel;
|
||||||
|
|
||||||
fn foo<F:FnOnce()+Send>(blk: F) {
|
fn foo<F:FnOnce()+Send>(blk: F) {
|
||||||
|
@ -11,8 +11,6 @@
|
|||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
fn call_it<F>(f: F)
|
fn call_it<F>(f: F)
|
||||||
where F : FnOnce(String) -> String
|
where F : FnOnce(String) -> String
|
||||||
{
|
{
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![allow(unknown_features)]
|
#![allow(unknown_features)]
|
||||||
#![feature(unboxed_closures, std_misc)]
|
#![feature(std_misc)]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
A somewhat reduced test case to expose some Valgrind issues.
|
A somewhat reduced test case to expose some Valgrind issues.
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
// pretty-expanded FIXME #23616
|
// pretty-expanded FIXME #23616
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
#![allow(unused_variables)]
|
#![allow(unused_variables)]
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
|
@ -10,8 +10,6 @@
|
|||||||
|
|
||||||
// pretty-expanded FIXME #23616
|
// pretty-expanded FIXME #23616
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
// Test that `F : Fn(isize) -> isize + Send` is interpreted as two
|
// Test that `F : Fn(isize) -> isize + Send` is interpreted as two
|
||||||
// distinct bounds on `F`.
|
// distinct bounds on `F`.
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
// pretty-expanded FIXME #23616
|
// pretty-expanded FIXME #23616
|
||||||
|
|
||||||
#![allow(unknown_features)]
|
#![allow(unknown_features)]
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
// Test that `Fn(isize) -> isize + 'static` parses as `(Fn(isize) -> isize) +
|
// Test that `Fn(isize) -> isize + 'static` parses as `(Fn(isize) -> isize) +
|
||||||
// 'static` and not `Fn(isize) -> (isize + 'static)`. The latter would
|
// 'static` and not `Fn(isize) -> (isize + 'static)`. The latter would
|
||||||
|
@ -8,9 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
// A basic test of using a higher-ranked trait bound.
|
// A basic test of using a higher-ranked trait bound.
|
||||||
|
|
||||||
trait FnLike<A,R> {
|
trait FnLike<A,R> {
|
||||||
|
@ -10,8 +10,6 @@
|
|||||||
|
|
||||||
// Test HRTB used with the `Fn` trait.
|
// Test HRTB used with the `Fn` trait.
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
fn foo<F:Fn(&isize)>(f: F) {
|
fn foo<F:Fn(&isize)>(f: F) {
|
||||||
let x = 22;
|
let x = 22;
|
||||||
f(&x);
|
f(&x);
|
||||||
|
@ -10,8 +10,6 @@
|
|||||||
|
|
||||||
// pretty-expanded FIXME #23616
|
// pretty-expanded FIXME #23616
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
fn f<F:FnOnce()>(p: F) {
|
fn f<F:FnOnce()>(p: F) {
|
||||||
p();
|
p();
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,6 @@
|
|||||||
|
|
||||||
// ignore-emscripten no threads support
|
// ignore-emscripten no threads support
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
// ignore-pretty
|
// ignore-pretty
|
||||||
|
|
||||||
#![allow(unknown_features)]
|
#![allow(unknown_features)]
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
struct Parser<'a, I, O> {
|
struct Parser<'a, I, O> {
|
||||||
parse: Box<FnMut(I) -> Result<O, String> + 'a>
|
parse: Box<FnMut(I) -> Result<O, String> + 'a>
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
#![allow(unknown_features)]
|
#![allow(unknown_features)]
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
#![feature(box_patterns)]
|
#![feature(box_patterns)]
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
|
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -12,9 +12,6 @@
|
|||||||
// once closure as an optimization by trans. This used to hit an
|
// once closure as an optimization by trans. This used to hit an
|
||||||
// incorrect assert.
|
// incorrect assert.
|
||||||
|
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = 2u8;
|
let x = 2u8;
|
||||||
let y = 3u8;
|
let y = 3u8;
|
||||||
|
@ -13,8 +13,6 @@
|
|||||||
|
|
||||||
// pretty-expanded FIXME #23616
|
// pretty-expanded FIXME #23616
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
trait Tr {
|
trait Tr {
|
||||||
fn foo(&self);
|
fn foo(&self);
|
||||||
|
|
||||||
|
@ -13,8 +13,6 @@
|
|||||||
|
|
||||||
// pretty-expanded FIXME #23616
|
// pretty-expanded FIXME #23616
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
// aux-build:issue-18711.rs
|
// aux-build:issue-18711.rs
|
||||||
extern crate issue_18711 as issue;
|
extern crate issue_18711 as issue;
|
||||||
|
|
||||||
|
@ -10,8 +10,6 @@
|
|||||||
|
|
||||||
// pretty-expanded FIXME #23616
|
// pretty-expanded FIXME #23616
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
fn foo<T, F: FnOnce(T) -> T>(f: F) {}
|
fn foo<T, F: FnOnce(T) -> T>(f: F) {}
|
||||||
fn id<'a>(input: &'a u8) -> &'a u8 { input }
|
fn id<'a>(input: &'a u8) -> &'a u8 { input }
|
||||||
|
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(rustc_attrs, unboxed_closures, fn_traits)]
|
#![feature(rustc_attrs, fn_traits)]
|
||||||
|
|
||||||
#[rustc_mir]
|
#[rustc_mir]
|
||||||
fn test1(a: isize, b: (i32, i32), c: &[i32]) -> (isize, (i32, i32), &[i32]) {
|
fn test1(a: isize, b: (i32, i32), c: &[i32]) -> (isize, (i32, i32), &[i32]) {
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
#![allow(unknown_features)]
|
#![allow(unknown_features)]
|
||||||
#![feature(box_syntax, std_misc)]
|
#![feature(box_syntax, std_misc)]
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::sync::mpsc::channel;
|
use std::sync::mpsc::channel;
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
// Also acts as a regression test for an ICE (issue #19791)
|
// Also acts as a regression test for an ICE (issue #19791)
|
||||||
|
|
||||||
|
|
||||||
#![feature(unboxed_closures, core)]
|
#![feature(core)]
|
||||||
|
|
||||||
use std::any::{Any, TypeId};
|
use std::any::{Any, TypeId};
|
||||||
|
|
||||||
|
@ -8,8 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
#![feature(lang_items)]
|
||||||
#![feature(lang_items, unboxed_closures)]
|
|
||||||
|
|
||||||
fn a<F:Fn(isize, isize) -> isize>(f: F) -> isize {
|
fn a<F:Fn(isize, isize) -> isize>(f: F) -> isize {
|
||||||
f(1, 2)
|
f(1, 2)
|
||||||
|
@ -10,8 +10,7 @@
|
|||||||
|
|
||||||
// Test that you can supply `&F` where `F: FnMut()`.
|
// Test that you can supply `&F` where `F: FnMut()`.
|
||||||
|
|
||||||
|
#![feature(lang_items)]
|
||||||
#![feature(lang_items, unboxed_closures)]
|
|
||||||
|
|
||||||
fn a<F:FnMut() -> i32>(mut f: F) -> i32 {
|
fn a<F:FnMut() -> i32>(mut f: F) -> i32 {
|
||||||
f()
|
f()
|
||||||
|
@ -10,8 +10,7 @@
|
|||||||
|
|
||||||
// Test that you can supply `&F` where `F: Fn()`.
|
// Test that you can supply `&F` where `F: Fn()`.
|
||||||
|
|
||||||
|
#![feature(lang_items)]
|
||||||
#![feature(lang_items, unboxed_closures)]
|
|
||||||
|
|
||||||
fn a<F:Fn() -> i32>(f: F) -> i32 {
|
fn a<F:Fn() -> i32>(f: F) -> i32 {
|
||||||
f()
|
f()
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
#![allow(unknown_features)]
|
#![allow(unknown_features)]
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
use std::ops::FnMut;
|
use std::ops::FnMut;
|
||||||
|
|
||||||
|
@ -8,9 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
// Test by-ref capture of environment in unboxed closure types
|
// Test by-ref capture of environment in unboxed closure types
|
||||||
|
|
||||||
fn call_fn<F: Fn()>(f: F) {
|
fn call_fn<F: Fn()>(f: F) {
|
||||||
|
@ -10,9 +10,6 @@
|
|||||||
|
|
||||||
// Test that the call operator autoderefs when calling a bounded type parameter.
|
// Test that the call operator autoderefs when calling a bounded type parameter.
|
||||||
|
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
use std::ops::FnMut;
|
use std::ops::FnMut;
|
||||||
|
|
||||||
fn call_with_2(x: &fn(isize) -> isize) -> isize
|
fn call_with_2(x: &fn(isize) -> isize) -> isize
|
||||||
|
@ -10,9 +10,6 @@
|
|||||||
|
|
||||||
// Test that the call operator autoderefs when calling a bounded type parameter.
|
// Test that the call operator autoderefs when calling a bounded type parameter.
|
||||||
|
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
use std::ops::FnMut;
|
use std::ops::FnMut;
|
||||||
|
|
||||||
fn call_with_2<F>(x: &mut F) -> isize
|
fn call_with_2<F>(x: &mut F) -> isize
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
// Test that the call operator autoderefs when calling to an object type.
|
// Test that the call operator autoderefs when calling to an object type.
|
||||||
|
|
||||||
#![allow(unknown_features)]
|
#![allow(unknown_features)]
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
use std::ops::FnMut;
|
use std::ops::FnMut;
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![allow(unknown_features)]
|
#![allow(unknown_features)]
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
use std::ops::FnMut;
|
use std::ops::FnMut;
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
// Test that we mutate a counter on the stack only when we expect to.
|
// Test that we mutate a counter on the stack only when we expect to.
|
||||||
|
|
||||||
|
|
||||||
fn call<F>(f: F) where F : FnOnce() {
|
fn call<F>(f: F) where F : FnOnce() {
|
||||||
f();
|
f();
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,6 @@
|
|||||||
|
|
||||||
// pretty-expanded FIXME #23616
|
// pretty-expanded FIXME #23616
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut unboxed = || {};
|
let mut unboxed = || {};
|
||||||
unboxed();
|
unboxed();
|
||||||
|
@ -11,9 +11,6 @@
|
|||||||
// A battery of tests to ensure destructors of unboxed closure environments
|
// A battery of tests to ensure destructors of unboxed closure environments
|
||||||
// run at the right times.
|
// run at the right times.
|
||||||
|
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
static mut DROP_COUNT: usize = 0;
|
static mut DROP_COUNT: usize = 0;
|
||||||
|
|
||||||
fn drop_count() -> usize {
|
fn drop_count() -> usize {
|
||||||
|
@ -10,10 +10,6 @@
|
|||||||
|
|
||||||
// Checks that extern fn pointers implement the full range of Fn traits.
|
// Checks that extern fn pointers implement the full range of Fn traits.
|
||||||
|
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
use std::ops::{Fn,FnMut,FnOnce};
|
use std::ops::{Fn,FnMut,FnOnce};
|
||||||
|
|
||||||
fn square(x: isize) -> isize { x * x }
|
fn square(x: isize) -> isize { x * x }
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
// Checks that the Fn trait hierarchy rules permit
|
// Checks that the Fn trait hierarchy rules permit
|
||||||
// any Fn trait to be used where Fn is implemented.
|
// any Fn trait to be used where Fn is implemented.
|
||||||
|
|
||||||
|
|
||||||
#![feature(unboxed_closures, fn_traits)]
|
#![feature(unboxed_closures, fn_traits)]
|
||||||
|
|
||||||
use std::ops::{Fn,FnMut,FnOnce};
|
use std::ops::{Fn,FnMut,FnOnce};
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
// Checks that the Fn trait hierarchy rules permit
|
// Checks that the Fn trait hierarchy rules permit
|
||||||
// FnMut or FnOnce to be used where FnMut is implemented.
|
// FnMut or FnOnce to be used where FnMut is implemented.
|
||||||
|
|
||||||
|
|
||||||
#![feature(unboxed_closures, fn_traits)]
|
#![feature(unboxed_closures, fn_traits)]
|
||||||
|
|
||||||
struct S;
|
struct S;
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
use std::ops::FnMut;
|
use std::ops::FnMut;
|
||||||
|
|
||||||
fn call_it<F:FnMut(i32,i32)->i32>(y: i32, mut f: F) -> i32 {
|
fn call_it<F:FnMut(i32,i32)->i32>(y: i32, mut f: F) -> i32 {
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
// Test that we are able to infer a suitable kind for this closure
|
// Test that we are able to infer a suitable kind for this closure
|
||||||
// that is just called (`FnMut`).
|
// that is just called (`FnMut`).
|
||||||
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut counter = 0;
|
let mut counter = 0;
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
// Test that we are able to infer a suitable kind for this `move`
|
// Test that we are able to infer a suitable kind for this `move`
|
||||||
// closure that is just called (`FnMut`).
|
// closure that is just called (`FnMut`).
|
||||||
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut counter = 0;
|
let mut counter = 0;
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
// Test that we are able to infer a suitable kind for this closure
|
// Test that we are able to infer a suitable kind for this closure
|
||||||
// that is just called (`FnMut`).
|
// that is just called (`FnMut`).
|
||||||
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut counter = 0;
|
let mut counter = 0;
|
||||||
|
|
||||||
|
@ -11,9 +11,6 @@
|
|||||||
// Test that we can infer the "kind" of an unboxed closure based on
|
// Test that we can infer the "kind" of an unboxed closure based on
|
||||||
// the expected type.
|
// the expected type.
|
||||||
|
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
// Test by-ref capture of environment in unboxed closure types
|
// Test by-ref capture of environment in unboxed closure types
|
||||||
|
|
||||||
fn call_fn<F: Fn()>(f: F) {
|
fn call_fn<F: Fn()>(f: F) {
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
// Test that the type variable in the type(`Vec<_>`) of a closed over
|
// Test that the type variable in the type(`Vec<_>`) of a closed over
|
||||||
// variable does not interfere with type inference.
|
// variable does not interfere with type inference.
|
||||||
|
|
||||||
|
|
||||||
fn f<F: FnMut()>(mut f: F) {
|
fn f<F: FnMut()>(mut f: F) {
|
||||||
f();
|
f();
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
// pretty-expanded FIXME #23616
|
// pretty-expanded FIXME #23616
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
#![deny(unused_mut)]
|
#![deny(unused_mut)]
|
||||||
|
|
||||||
// Test that mutating a mutable upvar in a capture-by-value unboxed
|
// Test that mutating a mutable upvar in a capture-by-value unboxed
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
// Test that in a by-ref once closure we move some variables even as
|
// Test that in a by-ref once closure we move some variables even as
|
||||||
// we capture others by mutable reference.
|
// we capture others by mutable reference.
|
||||||
|
|
||||||
|
|
||||||
fn call<F>(f: F) where F : FnOnce() {
|
fn call<F>(f: F) where F : FnOnce() {
|
||||||
f();
|
f();
|
||||||
}
|
}
|
||||||
|
@ -8,9 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
use std::ops::FnMut;
|
use std::ops::FnMut;
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
|
@ -11,9 +11,6 @@
|
|||||||
// Ensures that single-word environments work right in unboxed closures.
|
// Ensures that single-word environments work right in unboxed closures.
|
||||||
// These take a different path in codegen.
|
// These take a different path in codegen.
|
||||||
|
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
fn a<F:Fn(isize, isize) -> isize>(f: F) -> isize {
|
fn a<F:Fn(isize, isize) -> isize>(f: F) -> isize {
|
||||||
f(1, 2)
|
f(1, 2)
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,6 @@
|
|||||||
|
|
||||||
// pretty-expanded FIXME #23616
|
// pretty-expanded FIXME #23616
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let onetime = |x| x;
|
let onetime = |x| x;
|
||||||
onetime(0);
|
onetime(0);
|
||||||
|
@ -10,9 +10,7 @@
|
|||||||
|
|
||||||
// Test unboxed closure sugar used in object types.
|
// Test unboxed closure sugar used in object types.
|
||||||
|
|
||||||
|
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
struct Foo<T,U> {
|
struct Foo<T,U> {
|
||||||
t: T, u: U
|
t: T, u: U
|
||||||
|
@ -19,9 +19,6 @@
|
|||||||
//
|
//
|
||||||
// compile-flags: -g
|
// compile-flags: -g
|
||||||
|
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
pub fn replace_map<'a, T, F>(src: &mut T, prod: F) where F: FnOnce(T) -> T {
|
pub fn replace_map<'a, T, F>(src: &mut T, prod: F) where F: FnOnce(T) -> T {
|
||||||
|
@ -10,8 +10,6 @@
|
|||||||
|
|
||||||
// pretty-expanded FIXME #23616
|
// pretty-expanded FIXME #23616
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut zero = || {};
|
let mut zero = || {};
|
||||||
let () = zero();
|
let () = zero();
|
||||||
|
@ -10,8 +10,6 @@
|
|||||||
|
|
||||||
// pretty-expanded FIXME #23616
|
// pretty-expanded FIXME #23616
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
|
||||||
|
|
||||||
struct Bencher;
|
struct Bencher;
|
||||||
|
|
||||||
// ICE
|
// ICE
|
||||||
|
Loading…
Reference in New Issue
Block a user