fix cfail tests
This commit is contained in:
parent
ca17d08126
commit
7d5b0454e9
101 changed files with 195 additions and 612 deletions
|
@ -11,7 +11,7 @@
|
|||
|
||||
struct sty(Vec<int> );
|
||||
|
||||
fn unpack(_unpack: |v: &sty| -> Vec<int> ) {}
|
||||
fn unpack<F>(_unpack: F) where F: FnOnce(&sty) -> Vec<int> {}
|
||||
|
||||
fn main() {
|
||||
let _foo = unpack(|s| {
|
||||
|
|
|
@ -27,5 +27,5 @@ fn cat(in_x : uint, in_y : int) -> cat {
|
|||
|
||||
fn main() {
|
||||
let nyan : cat = cat(52u, 99);
|
||||
nyan.speak = || println!("meow"); //~ ERROR attempted to take value of method
|
||||
nyan.speak = |&:| println!("meow"); //~ ERROR attempted to take value of method
|
||||
}
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
// Copyright 2012 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.
|
||||
|
||||
// Make sure that fn-to-block coercion isn't incorrectly lifted over
|
||||
// other tycons.
|
||||
|
||||
fn main() {
|
||||
fn f(f: fn(fn(fn()))) {
|
||||
}
|
||||
|
||||
fn g(f: fn(||)) {
|
||||
}
|
||||
|
||||
f(g);
|
||||
//~^ ERROR mismatched types: expected `fn(fn(fn()))`
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
// Copyright 2012 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.
|
||||
|
||||
// Make sure that fn-to-block coercion isn't incorrectly lifted over
|
||||
// other tycons.
|
||||
|
||||
fn coerce(b: ||) -> extern fn() {
|
||||
fn lol(f: extern fn(v: ||) -> extern fn(),
|
||||
g: ||) -> extern fn() { return f(g); }
|
||||
fn fn_id(f: extern fn()) -> extern fn() { return f }
|
||||
return lol(fn_id, b);
|
||||
//~^ ERROR mismatched types
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let i = 8i;
|
||||
let f = coerce(|| println!("{}", i) );
|
||||
f();
|
||||
}
|
|
@ -24,7 +24,7 @@ fn a() {
|
|||
println!("{}", *q);
|
||||
}
|
||||
|
||||
fn borrow(_x: &[int], _f: ||) {}
|
||||
fn borrow<F>(_x: &[int], _f: F) where F: FnOnce() {}
|
||||
|
||||
fn b() {
|
||||
// here we alias the mutable vector into an imm slice and try to
|
||||
|
|
|
@ -13,7 +13,7 @@ enum Either<T, U> { Left(T), Right(U) }
|
|||
struct X(Either<(uint,uint), fn()>);
|
||||
|
||||
impl X {
|
||||
pub fn with(&self, blk: |x: &Either<(uint,uint), fn()>|) {
|
||||
pub fn with<F>(&self, blk: F) where F: FnOnce(&Either<(uint, uint), fn()>) {
|
||||
let X(ref e) = *self;
|
||||
blk(e)
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ fn main() {
|
|||
|opt| { //~ ERROR cannot borrow `x` as mutable more than once at a time
|
||||
match opt {
|
||||
&Either::Right(ref f) => {
|
||||
x = X(Either::Left((0,0)));
|
||||
x = X(Either::Left((0, 0)));
|
||||
(*f)()
|
||||
},
|
||||
_ => panic!()
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn force(f: ||) { f(); }
|
||||
fn force<F>(f: F) where F: FnOnce() { f(); }
|
||||
fn main() {
|
||||
let x: int;
|
||||
force(|| { //~ ERROR capture of possibly uninitialized variable: `x`
|
||||
|
|
|
@ -10,53 +10,54 @@
|
|||
|
||||
// Ensure that invoking a closure counts as a unique immutable borrow
|
||||
|
||||
#![feature(unboxed_closures)]
|
||||
|
||||
type Fn<'a> = ||:'a;
|
||||
type Fn<'a> = Box<FnMut() + 'a>;
|
||||
|
||||
struct Test<'a> {
|
||||
f: ||: 'a
|
||||
f: Box<FnMut() + 'a>
|
||||
}
|
||||
|
||||
fn call(f: |Fn|) {
|
||||
f(|| {
|
||||
//~^ ERROR: closure requires unique access to `f` but it is already borrowed
|
||||
f(|| {})
|
||||
fn call<F>(mut f: F) where F: FnMut(Fn) {
|
||||
f(box || {
|
||||
//~^ ERROR: cannot borrow `f` as mutable more than once
|
||||
f(box || {})
|
||||
});
|
||||
}
|
||||
|
||||
fn test1() {
|
||||
call(|a| {
|
||||
a();
|
||||
call(|mut a| {
|
||||
a.call_mut(());
|
||||
});
|
||||
}
|
||||
|
||||
fn test2(f: &||) {
|
||||
(*f)(); //~ ERROR: closure invocation in a `&` reference
|
||||
fn test2<F>(f: &F) where F: FnMut() {
|
||||
(*f)(); //~ ERROR: cannot borrow immutable dereference of `&`-pointer `*f` as mutable
|
||||
}
|
||||
|
||||
fn test3(f: &mut ||) {
|
||||
fn test3<F>(f: &mut F) where F: FnMut() {
|
||||
(*f)();
|
||||
}
|
||||
|
||||
fn test4(f: &Test) {
|
||||
(f.f)() //~ ERROR: closure invocation in a `&` reference
|
||||
f.f.call_mut(()) //~ ERROR: cannot borrow immutable dereference of `Box` `*f.f` as mutable
|
||||
}
|
||||
|
||||
fn test5(f: &mut Test) {
|
||||
(f.f)()
|
||||
f.f.call_mut(())
|
||||
}
|
||||
|
||||
fn test6() {
|
||||
let f = || {};
|
||||
(|| {
|
||||
let mut f = |&mut:| {};
|
||||
(|&mut:| {
|
||||
f();
|
||||
})();
|
||||
}
|
||||
|
||||
fn test7() {
|
||||
fn foo(_: |g: |int|, b: int|) {}
|
||||
let f = |g: |int|, b: int| {};
|
||||
f(|a| { //~ ERROR: cannot borrow `f` as immutable because previous closure
|
||||
fn foo<F>(_: F) where F: FnMut(Box<FnMut(int)>, int) {}
|
||||
let mut f = |&mut: g: Box<FnMut(int)>, b: int| {};
|
||||
f(box |a| { //~ ERROR: cannot borrow `f` as immutable because it is also borrowed as mutable
|
||||
foo(f); //~ ERROR: cannot move out of captured outer variable
|
||||
}, 3);
|
||||
}
|
||||
|
|
|
@ -22,37 +22,37 @@ fn set(x: &mut int) {
|
|||
|
||||
fn a() {
|
||||
let mut x = 3i;
|
||||
let c1 = || x = 4;
|
||||
let c2 = || x * 5; //~ ERROR cannot borrow `x`
|
||||
let c1 = |&mut:| x = 4;
|
||||
let c2 = |&mut:| x * 5; //~ ERROR cannot borrow `x`
|
||||
}
|
||||
|
||||
fn b() {
|
||||
let mut x = 3i;
|
||||
let c1 = || set(&mut x);
|
||||
let c2 = || get(&x); //~ ERROR cannot borrow `x`
|
||||
let c1 = |&mut:| set(&mut x);
|
||||
let c2 = |&mut:| get(&x); //~ ERROR cannot borrow `x`
|
||||
}
|
||||
|
||||
fn c() {
|
||||
let mut x = 3i;
|
||||
let c1 = || set(&mut x);
|
||||
let c2 = || x * 5; //~ ERROR cannot borrow `x`
|
||||
let c1 = |&mut:| set(&mut x);
|
||||
let c2 = |&mut:| x * 5; //~ ERROR cannot borrow `x`
|
||||
}
|
||||
|
||||
fn d() {
|
||||
let mut x = 3i;
|
||||
let c2 = || x * 5;
|
||||
let c2 = |&mut:| x * 5;
|
||||
x = 5; //~ ERROR cannot assign
|
||||
}
|
||||
|
||||
fn e() {
|
||||
let mut x = 3i;
|
||||
let c1 = || get(&x);
|
||||
let c1 = |&mut:| get(&x);
|
||||
x = 5; //~ ERROR cannot assign
|
||||
}
|
||||
|
||||
fn f() {
|
||||
let mut x = box 3i;
|
||||
let c1 = || get(&*x);
|
||||
let c1 = |&mut:| get(&*x);
|
||||
*x = 5; //~ ERROR cannot assign
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ fn g() {
|
|||
}
|
||||
|
||||
let mut x = box Foo { f: box 3 };
|
||||
let c1 = || get(&*x.f);
|
||||
let c1 = |&mut:| get(&*x.f);
|
||||
*x.f = 5; //~ ERROR cannot assign to `*x.f`
|
||||
}
|
||||
|
||||
|
@ -72,8 +72,8 @@ fn h() {
|
|||
}
|
||||
|
||||
let mut x = box Foo { f: box 3 };
|
||||
let c1 = || get(&*x.f);
|
||||
let c2 = || *x.f = 5; //~ ERROR cannot borrow `x` as mutable
|
||||
let c1 = |&mut:| get(&*x.f);
|
||||
let c2 = |&mut:| *x.f = 5; //~ ERROR cannot borrow `x` as mutable
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -20,9 +20,9 @@ fn set(x: &mut int) {
|
|||
}
|
||||
|
||||
fn a(x: &int) {
|
||||
let c1 = || set(&mut *x);
|
||||
let c1 = |&mut:| set(&mut *x);
|
||||
//~^ ERROR cannot borrow
|
||||
let c2 = || set(&mut *x);
|
||||
let c2 = |&mut:| set(&mut *x);
|
||||
//~^ ERROR cannot borrow
|
||||
//~| ERROR closure requires unique access
|
||||
}
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
|
||||
fn a() {
|
||||
let mut x = 3i;
|
||||
let c1 = || x = 4;
|
||||
let c2 = || x = 5; //~ ERROR cannot borrow `x` as mutable more than once
|
||||
let c1 = |&mut:| x = 4;
|
||||
let c2 = |&mut:| x = 5; //~ ERROR cannot borrow `x` as mutable more than once
|
||||
}
|
||||
|
||||
fn set(x: &mut int) {
|
||||
|
@ -25,20 +25,20 @@ fn set(x: &mut int) {
|
|||
|
||||
fn b() {
|
||||
let mut x = 3i;
|
||||
let c1 = || set(&mut x);
|
||||
let c2 = || set(&mut x); //~ ERROR cannot borrow `x` as mutable more than once
|
||||
let c1 = |&mut:| set(&mut x);
|
||||
let c2 = |&mut:| set(&mut x); //~ ERROR cannot borrow `x` as mutable more than once
|
||||
}
|
||||
|
||||
fn c() {
|
||||
let mut x = 3i;
|
||||
let c1 = || x = 5;
|
||||
let c2 = || set(&mut x); //~ ERROR cannot borrow `x` as mutable more than once
|
||||
let c1 = |&mut:| x = 5;
|
||||
let c2 = |&mut:| set(&mut x); //~ ERROR cannot borrow `x` as mutable more than once
|
||||
}
|
||||
|
||||
fn d() {
|
||||
let mut x = 3i;
|
||||
let c1 = || x = 5;
|
||||
let c2 = || { let _y = || set(&mut x); }; // (nested closure)
|
||||
let c1 = |&mut:| x = 5;
|
||||
let c2 = |&mut:| { let _y = |&mut:| set(&mut x); }; // (nested closure)
|
||||
//~^ ERROR cannot borrow `x` as mutable more than once
|
||||
}
|
||||
|
||||
|
@ -48,8 +48,8 @@ fn g() {
|
|||
}
|
||||
|
||||
let mut x = box Foo { f: box 3 };
|
||||
let c1 = || set(&mut *x.f);
|
||||
let c2 = || set(&mut *x.f);
|
||||
let c1 = |&mut:| set(&mut *x.f);
|
||||
let c2 = |&mut:| set(&mut *x.f);
|
||||
//~^ ERROR cannot borrow `x` as mutable more than once
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ pub fn main() {
|
|||
let mut this = &mut Foo {
|
||||
x: 1,
|
||||
};
|
||||
let r = || {
|
||||
let mut r = |&mut:| {
|
||||
let p = &this.x;
|
||||
&mut this.x; //~ ERROR cannot borrow
|
||||
};
|
||||
|
|
|
@ -23,27 +23,27 @@ fn set(x: &mut int) -> int {
|
|||
}
|
||||
|
||||
fn a(x: &mut int) {
|
||||
let c1 = || get(x);
|
||||
let c2 = || get(x);
|
||||
let c1 = |&mut:| get(x);
|
||||
let c2 = |&mut:| get(x);
|
||||
}
|
||||
|
||||
fn b(x: &mut int) {
|
||||
let c1 = || get(x);
|
||||
let c2 = || set(x); //~ ERROR closure requires unique access to `x`
|
||||
let c1 = |&mut:| get(x);
|
||||
let c2 = |&mut:| set(x); //~ ERROR closure requires unique access to `x`
|
||||
}
|
||||
|
||||
fn c(x: &mut int) {
|
||||
let c1 = || get(x);
|
||||
let c2 = || { get(x); set(x); }; //~ ERROR closure requires unique access to `x`
|
||||
let c1 = |&mut:| get(x);
|
||||
let c2 = |&mut:| { get(x); set(x); }; //~ ERROR closure requires unique access to `x`
|
||||
}
|
||||
|
||||
fn d(x: &mut int) {
|
||||
let c1 = || set(x);
|
||||
let c2 = || set(x); //~ ERROR closure requires unique access to `x`
|
||||
let c1 = |&mut:| set(x);
|
||||
let c2 = |&mut:| set(x); //~ ERROR closure requires unique access to `x`
|
||||
}
|
||||
|
||||
fn e(x: &mut int) {
|
||||
let c1: || = || x = panic!(); //~ ERROR closure cannot assign to immutable local variable
|
||||
let c1 = |&mut:| x = panic!(); //~ ERROR closure cannot assign to immutable local variable
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -25,7 +25,7 @@ impl Drop for Foo {
|
|||
|
||||
fn main() {
|
||||
let mut ptr = box Foo { x: 0 };
|
||||
let test = |foo: &Foo| {
|
||||
let mut test = |&mut: foo: &Foo| {
|
||||
ptr = box Foo { x: ptr.x + 1 };
|
||||
};
|
||||
test(&*ptr); //~ ERROR cannot borrow `*ptr`
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
let j: || -> int = || {
|
||||
let j = |&:| -> int {
|
||||
let i: int;
|
||||
i //~ ERROR use of possibly uninitialized variable: `i`
|
||||
};
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
let f: || -> int = || {
|
||||
let f = |&:| -> int {
|
||||
let i: int;
|
||||
i //~ ERROR use of possibly uninitialized variable: `i`
|
||||
};
|
||||
|
|
|
@ -16,7 +16,7 @@ struct Foo {
|
|||
}
|
||||
|
||||
impl Foo {
|
||||
pub fn foo(&mut self, fun: |&int|) {
|
||||
pub fn foo<F>(&mut self, mut fun: F) where F: FnMut(&int) {
|
||||
for f in self.n.iter() {
|
||||
fun(f);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
fn borrow(_v: &int) {}
|
||||
fn borrow_mut(_v: &mut int) {}
|
||||
fn cond() -> bool { panic!() }
|
||||
fn for_func(_f: || -> bool) { panic!() }
|
||||
fn for_func<F>(_f: F) where F: FnOnce() -> bool { panic!() }
|
||||
fn produce<T>() -> T { panic!(); }
|
||||
|
||||
fn inc(v: &mut Box<int>) {
|
||||
|
|
|
@ -112,7 +112,9 @@ fn while_aliased_mut_cond(cond: bool, cond2: bool) {
|
|||
}
|
||||
}
|
||||
|
||||
fn loop_break_pops_scopes<'r>(_v: &'r mut [uint], f: |&'r mut uint| -> bool) {
|
||||
fn loop_break_pops_scopes<'r, F>(_v: &'r mut [uint], mut f: F) where
|
||||
F: FnMut(&'r mut uint) -> bool,
|
||||
{
|
||||
// Here we check that when you break out of an inner loop, the
|
||||
// borrows that go out of scope as you exit the inner loop are
|
||||
// removed from the bitset.
|
||||
|
@ -128,7 +130,7 @@ fn loop_break_pops_scopes<'r>(_v: &'r mut [uint], f: |&'r mut uint| -> bool) {
|
|||
}
|
||||
}
|
||||
|
||||
fn loop_loop_pops_scopes<'r>(_v: &'r mut [uint], f: |&'r mut uint| -> bool) {
|
||||
fn loop_loop_pops_scopes<'r, F>(_v: &'r mut [uint], mut f: F) where F: FnMut(&'r mut uint) -> bool {
|
||||
// Similar to `loop_break_pops_scopes` but for the `loop` keyword
|
||||
|
||||
while cond() {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
fn borrow(_v: &int) {}
|
||||
fn borrow_mut(_v: &mut int) {}
|
||||
fn cond() -> bool { panic!() }
|
||||
fn for_func(_f: || -> bool) { panic!() }
|
||||
fn for_func<F>(_f: F) where F: FnOnce() -> bool { panic!() }
|
||||
fn produce<T>() -> T { panic!(); }
|
||||
|
||||
fn inc(v: &mut Box<int>) {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
use std::thread::Thread;
|
||||
|
||||
fn borrow(v: &int, f: |x: &int|) {
|
||||
fn borrow<F>(v: &int, f: F) where F: FnOnce(&int) {
|
||||
f(v);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn borrow(v: &int, f: |x: &int|) {
|
||||
fn borrow<F>(v: &int, f: F) where F: FnOnce(&int) {
|
||||
f(v);
|
||||
}
|
||||
|
||||
|
|
|
@ -13,14 +13,14 @@ struct point { x: int, y: int }
|
|||
|
||||
trait methods {
|
||||
fn impurem(&self);
|
||||
fn blockm(&self, f: ||);
|
||||
fn blockm<F>(&self, f: F) where F: FnOnce();
|
||||
}
|
||||
|
||||
impl methods for point {
|
||||
fn impurem(&self) {
|
||||
}
|
||||
|
||||
fn blockm(&self, f: ||) { f() }
|
||||
fn blockm<F>(&self, f: F) where F: FnOnce() { f() }
|
||||
}
|
||||
|
||||
fn a() {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// (locally rooted) mutable, unique vector, and that we then prevent
|
||||
// modifications to the contents.
|
||||
|
||||
fn takes_imm_elt(_v: &int, f: ||) {
|
||||
fn takes_imm_elt<F>(_v: &int, f: F) where F: FnOnce() {
|
||||
f();
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
pub fn main() {
|
||||
let bar = box 3;
|
||||
let _g = || {
|
||||
let _g = |&mut:| {
|
||||
let _h = move |:| -> int { *bar }; //~ ERROR cannot move out of captured outer variable
|
||||
};
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn with(f: |&String|) {}
|
||||
fn with<F>(f: F) where F: FnOnce(&String) {}
|
||||
|
||||
fn arg_item(&_x: &String) {}
|
||||
//~^ ERROR cannot move out of dereference of `&`-pointer
|
||||
|
|
|
@ -32,7 +32,7 @@ fn foo() {
|
|||
|
||||
fn bar() {
|
||||
// Original borrow ends at end of closure
|
||||
|| {
|
||||
|&:| {
|
||||
let mut x = 1u;
|
||||
let y = &mut x;
|
||||
let z = &mut x; //~ ERROR cannot borrow
|
||||
|
|
|
@ -14,7 +14,7 @@ struct Foo {
|
|||
|
||||
fn cond() -> bool { true }
|
||||
|
||||
fn foo(_: ||) {}
|
||||
fn foo<F>(_: F) where F: FnOnce() {}
|
||||
|
||||
fn main() {
|
||||
let pth = break; //~ ERROR: `break` outside of loop
|
||||
|
|
|
@ -8,12 +8,13 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
struct X {
|
||||
field: ||:'static + Send,
|
||||
struct X<F> where F: FnOnce() + 'static + Send {
|
||||
field: F,
|
||||
}
|
||||
|
||||
fn foo(blk: ||:'static) -> X {
|
||||
return X { field: blk }; //~ ERROR expected bounds `Send`
|
||||
fn foo<F>(blk: F) -> X<F> where F: FnOnce() + 'static {
|
||||
//~^ ERROR the trait `core::kinds::Send` is not implemented for the type
|
||||
return X { field: blk };
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
// 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.
|
||||
|
||||
|
||||
trait Foo {}
|
||||
|
||||
fn take(f: ||:Foo) {
|
||||
//~^ ERROR only the builtin traits can be used as closure or object bounds
|
||||
}
|
||||
|
||||
fn main() {}
|
|
@ -8,13 +8,12 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn bar(blk: ||:'static) {
|
||||
fn bar<F>(blk: F) where F: FnOnce() + 'static {
|
||||
}
|
||||
|
||||
fn foo(x: &()) {
|
||||
bar(|| { //~ ERROR cannot infer an appropriate lifetime
|
||||
let _ = x;
|
||||
//~^ ERROR captured variable `x` does not outlive
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -9,19 +9,19 @@
|
|||
// except according to those terms.
|
||||
|
||||
|
||||
fn take_any(_: ||) {
|
||||
fn take_any<F>(_: F) where F: FnOnce() {
|
||||
}
|
||||
|
||||
fn take_const_owned(_: ||:Sync+Send) {
|
||||
fn take_const_owned<F>(_: F) where F: FnOnce() + Sync + Send {
|
||||
}
|
||||
|
||||
fn give_any(f: ||) {
|
||||
fn give_any<F>(f: F) where F: FnOnce() {
|
||||
take_any(f);
|
||||
}
|
||||
|
||||
fn give_owned(f: ||:Send) {
|
||||
fn give_owned<F>(f: F) where F: FnOnce() + Send {
|
||||
take_any(f);
|
||||
take_const_owned(f); //~ ERROR expected bounds `Send+Sync`, found bounds `Send`
|
||||
take_const_owned(f); //~ ERROR the trait `core::kinds::Sync` is not implemented for the type
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -17,7 +17,7 @@ fn call_bare(f: fn(&str)) {
|
|||
|
||||
fn main() {
|
||||
let string = "world!";
|
||||
let f: |&str| = |s| println!("{}{}", s, string);
|
||||
let f = |&: s: &str| println!("{}{}", s, string);
|
||||
call_bare(f) //~ ERROR mismatched types
|
||||
}
|
||||
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
// 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.
|
||||
|
||||
fn foo(f: || -> !) {}
|
||||
|
||||
fn main() {
|
||||
// Type inference didn't use to be able to handle this:
|
||||
foo(|| panic!());
|
||||
foo(|| -> ! panic!());
|
||||
foo(|| 22i); //~ ERROR computation may converge in a function marked as diverging
|
||||
foo(|| -> ! 22i); //~ ERROR computation may converge in a function marked as diverging
|
||||
let x = || -> ! 1i; //~ ERROR computation may converge in a function marked as diverging
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
// 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 coercions from fn item types are ok, but not fn pointer
|
||||
// types to closures/procs are not allowed.
|
||||
|
||||
fn foo() {}
|
||||
|
||||
fn fn_item_type() {
|
||||
let f = foo;
|
||||
|
||||
let f_closure: || = f;
|
||||
}
|
||||
|
||||
fn fn_pointer_type() {
|
||||
let f = foo as fn();
|
||||
let f_closure: || = f;
|
||||
//~^ ERROR: mismatched types
|
||||
}
|
||||
|
||||
fn main() { }
|
|
@ -8,10 +8,12 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// ignore-test FIXME(#20574)
|
||||
|
||||
#![deny(unreachable_code)]
|
||||
|
||||
fn main() {
|
||||
let x: || -> ! = || panic!();
|
||||
let x = |:| panic!();
|
||||
x();
|
||||
std::io::println("Foo bar"); //~ ERROR: unreachable statement
|
||||
}
|
||||
|
|
|
@ -11,8 +11,10 @@
|
|||
extern fn f() {
|
||||
}
|
||||
|
||||
fn is_fn<F>(_: F) where F: Fn() {}
|
||||
|
||||
fn main() {
|
||||
// extern functions are extern "C" fn
|
||||
let _x: extern "C" fn() = f; // OK
|
||||
let _x: || = f; //~ ERROR mismatched types
|
||||
is_fn(f); //~ ERROR the trait `core::ops::Fn()` is not implemented for the type `extern "C" fn()
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ fn takes_imm(x: &int) { }
|
|||
|
||||
fn takes_mut(x: &mut int) { }
|
||||
|
||||
fn apply<T>(t: T, f: |T|) {
|
||||
fn apply<T, F>(t: T, f: F) where F: FnOnce(T) {
|
||||
f(t)
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ fn f(y: Box<int>) {
|
|||
}
|
||||
|
||||
fn g() {
|
||||
let _frob: |Box<int>| = |q| { *q = 2; }; //~ ERROR cannot assign
|
||||
let _frob = |&: q: Box<int>| { *q = 2; }; //~ ERROR cannot assign
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn test<'x>(x: &'x int) {
|
||||
drop::< for<'z>|&'z int| -> &'z int >(|z| {
|
||||
drop::<Box<for<'z> FnMut(&'z int) -> &'z int>>(box |z| {
|
||||
x
|
||||
//~^ ERROR cannot infer an appropriate lifetime
|
||||
});
|
||||
|
|
|
@ -20,7 +20,7 @@ impl Drop for Foo {
|
|||
|
||||
fn main() {
|
||||
let mut ptr = box Foo { x: 0 };
|
||||
let test = |foo: &Foo| {
|
||||
let mut test = |&mut: foo: &Foo| {
|
||||
println!("access {}", foo.x);
|
||||
ptr = box Foo { x: ptr.x + 1 };
|
||||
println!("access {}", foo.x);
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
fn main() {
|
||||
let mut v = vec!(1i);
|
||||
let f = || v.push(2i);
|
||||
let mut f = |&mut:| v.push(2i);
|
||||
let _w = v; //~ ERROR: cannot move out of `v`
|
||||
|
||||
f();
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// ignore-test FIXME(japari) remove test
|
||||
|
||||
struct Foo {
|
||||
f: for <'b> |&'b int|:
|
||||
'b -> &'b int //~ ERROR use of undeclared lifetime name `'b`
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
// wrong arity.
|
||||
|
||||
fn _foo<F: Fn()> (f: F) {
|
||||
|t| f(t); //~ ERROR E0057
|
||||
|&: t| f(t); //~ ERROR E0057
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
// 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.
|
||||
|
||||
trait MyItem<T> {}
|
||||
impl<T> MyItem<T> for T {}
|
||||
|
||||
pub fn build_archive<'a, I: MyItem<&'a (|&uint|:'a)>>(files: I) {}
|
||||
|
||||
fn main() {
|
||||
build_archive(&(|_| { }));
|
||||
//~^ ERROR not implemented
|
||||
}
|
|
@ -12,7 +12,7 @@
|
|||
// and rejected.
|
||||
|
||||
fn main() {
|
||||
(|| box *[0u].as_slice())();
|
||||
(|&:| box *[0u].as_slice())();
|
||||
//~^ ERROR cannot move out of dereference
|
||||
//~^^ ERROR cannot move a value of type [uint]
|
||||
}
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
struct Obj<'a> {
|
||||
closure: ||: 'a -> u32
|
||||
struct Obj<F> where F: FnMut() -> u32 {
|
||||
closure: F,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let o = Obj { closure: || 42 };
|
||||
o.closure(); //~ ERROR type `Obj<'_>` does not implement any method in scope named `closure`
|
||||
o.closure(); //~ ERROR does not implement any method in scope named `closure`
|
||||
//~^ NOTE use `(s.closure)(...)` if you meant to call the function stored in the `closure` field
|
||||
}
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
// 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.
|
||||
|
||||
type Step<'s, R, T> = |R, T|: 's -> R;
|
||||
type Transducer<'t, R, T, U> = |Step<'t, R, U>|: 't -> Step<'t, R, T>;
|
||||
|
||||
fn mapping<'f, R, T, U>(f: |T|: 'f -> U) -> &'f Transducer<'f, R, T, U> {
|
||||
|step| |r, x|
|
||||
step(r, f(x))
|
||||
//~^ ERROR the type of this value must be known in this context
|
||||
}
|
||||
|
||||
fn main() {}
|
|
@ -13,8 +13,8 @@ use std::cell::RefCell;
|
|||
fn main() {
|
||||
let c = RefCell::new(vec![]);
|
||||
let mut y = 1u;
|
||||
c.push(|| y = 0);
|
||||
c.push(|| y = 0);
|
||||
c.push(box || y = 0);
|
||||
c.push(box || y = 0);
|
||||
//~^ ERROR cannot borrow `y` as mutable more than once at a time
|
||||
}
|
||||
|
||||
|
@ -22,16 +22,16 @@ fn ufcs() {
|
|||
let c = RefCell::new(vec![]);
|
||||
let mut y = 1u;
|
||||
|
||||
Push::push(&c, || y = 0);
|
||||
Push::push(&c, || y = 0);
|
||||
Push::push(&c, box || y = 0);
|
||||
Push::push(&c, box || y = 0);
|
||||
}
|
||||
|
||||
trait Push<'c> {
|
||||
fn push<'f: 'c>(&self, push: ||:'f -> ());
|
||||
fn push<'f: 'c>(&self, push: Box<FnMut() + 'f>);
|
||||
}
|
||||
|
||||
impl<'c> Push<'c> for RefCell<Vec<||:'c>> {
|
||||
fn push<'f: 'c>(&self, fun: ||:'f -> ()) {
|
||||
impl<'c> Push<'c> for RefCell<Vec<Box<FnMut() + 'c>>> {
|
||||
fn push<'f: 'c>(&self, fun: Box<FnMut() + 'f>) {
|
||||
self.borrow_mut().push(fun)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
// 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.
|
||||
|
||||
#![feature(lang_items)]
|
||||
#![no_std]
|
||||
#![crate_type="rlib"]
|
||||
#[lang="sized"] pub trait Sized for Sized? {}
|
||||
|
||||
fn ice(f: for <'s> ||
|
||||
:'s //~ ERROR use of undeclared lifetime name `'s`
|
||||
) {}
|
||||
fn main() { ice(||{}) }
|
|
@ -1,15 +0,0 @@
|
|||
// 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.
|
||||
|
||||
fn main() {
|
||||
let n = 0u;
|
||||
|
||||
let f = move || n += 1; //~error boxed closures can't capture by value
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
// 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.
|
||||
|
||||
fn foo(t: &mut int){
|
||||
println!("{}", t);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let test = 10;
|
||||
|
||||
let h = move || { //~error boxed closures can't capture by value
|
||||
let mut r = &mut test.clone();
|
||||
foo(r);
|
||||
};
|
||||
|
||||
h();
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
// 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.
|
||||
|
||||
struct S;
|
||||
|
||||
impl S {
|
||||
fn foo(&self) {
|
||||
let _ = move || { self }; //~error boxed closures can't capture by value
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
// 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.
|
||||
|
||||
struct S;
|
||||
|
||||
impl S {
|
||||
fn foo(&self) {
|
||||
let _ = move || { self.foo() }; //~error boxed closures can't capture by value
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
}
|
|
@ -9,17 +9,17 @@
|
|||
// except according to those terms.
|
||||
|
||||
trait vec_monad<A> {
|
||||
fn bind<B>(&self, f: |A| -> Vec<B> );
|
||||
fn bind<B, F>(&self, f: F) where F: FnMut(A) -> Vec<B>;
|
||||
}
|
||||
|
||||
impl<A> vec_monad<A> for Vec<A> {
|
||||
fn bind<B>(&self, f: |A| -> Vec<B> ) {
|
||||
fn bind<B, F>(&self, mut f: F) where F: FnMut(A) -> Vec<B> {
|
||||
let mut r = panic!();
|
||||
for elt in self.iter() { r = r + f(*elt); }
|
||||
//~^ ERROR the type of this value must be known
|
||||
}
|
||||
}
|
||||
fn main() {
|
||||
["hi"].bind(|x| [x] );
|
||||
["hi"].bind(|&mut: x| [x] );
|
||||
//~^ ERROR type `[&str; 1]` does not implement any method in scope named `bind`
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
fn main() {
|
||||
let needlesArr: Vec<char> = vec!('a', 'f');
|
||||
needlesArr.iter().fold(|x, y| {
|
||||
needlesArr.iter().fold(|&: x, y| {
|
||||
});
|
||||
//~^^ ERROR this function takes 2 parameters but 1 parameter was supplied
|
||||
//
|
||||
|
|
|
@ -9,8 +9,9 @@
|
|||
// except according to those terms.
|
||||
|
||||
trait A {
|
||||
fn a(&self) {
|
||||
|| self.b() //~ ERROR type `&Self` does not implement any method in scope named `b`
|
||||
}
|
||||
fn a(&self) {
|
||||
|&:| self.b() //~ ERROR type `&Self` does not implement any method in scope named `b`
|
||||
//~^ ERROR expected (), found closure
|
||||
}
|
||||
}
|
||||
fn main() {}
|
||||
|
|
|
@ -8,13 +8,15 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(unboxed_closures)]
|
||||
|
||||
fn id<T>(t: T) -> T { t }
|
||||
|
||||
fn f<'r, T>(v: &'r T) -> ||: 'r -> T {
|
||||
id(|| *v) //~ ERROR cannot infer
|
||||
fn f<'r, T>(v: &'r T) -> Box<FnMut() -> T + 'r> {
|
||||
id(box |&mut:| *v) //~ ERROR cannot infer
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let v = &5i;
|
||||
println!("{}", f(v)());
|
||||
println!("{}", f(v).call_mut(()));
|
||||
}
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
// Copyright 2013 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.
|
||||
|
||||
fn foopy() {}
|
||||
|
||||
static f: ||: 'static = foopy;
|
||||
|
||||
fn main () {
|
||||
f(); //~ ERROR closure invocation in a static location
|
||||
}
|
|
@ -9,12 +9,12 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn f() { }
|
||||
struct S(||); //~ ERROR explicit lifetime bound required
|
||||
struct S(Box<FnMut()>); //~ ERROR explicit lifetime bound required
|
||||
pub static C: S = S(f);
|
||||
|
||||
|
||||
fn g() { }
|
||||
type T = ||; //~ ERROR explicit lifetime bound required
|
||||
type T = Box<FnMut()>; //~ ERROR explicit lifetime bound required
|
||||
pub static D: T = g;
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -11,6 +11,6 @@
|
|||
// Regression test for issue #5239
|
||||
|
||||
fn main() {
|
||||
let x: |int| -> int = |ref x| { x += 1; };
|
||||
let x = |&: ref x: int| -> int { x += 1; };
|
||||
//~^ ERROR binary assignment operation `+=` cannot be applied to type `&int`
|
||||
}
|
||||
|
|
|
@ -17,13 +17,13 @@ fn twice(x: Box<uint>) -> uint {
|
|||
*x * 2
|
||||
}
|
||||
|
||||
fn invoke(f: || -> uint) {
|
||||
fn invoke<F>(f: F) where F: FnOnce() -> uint {
|
||||
f();
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let x : Box<uint> = box 9;
|
||||
let sq : || -> uint = || { *x * *x };
|
||||
let sq = |:| { *x * *x };
|
||||
|
||||
twice(x); //~ ERROR: cannot move out of
|
||||
invoke(sq);
|
||||
|
|
|
@ -25,7 +25,7 @@ impl CrateId {
|
|||
|
||||
pub fn remove_package_from_database() {
|
||||
let mut lines_to_use: Vec<&CrateId> = Vec::new();
|
||||
let push_id = |installed_id: &CrateId| {
|
||||
let push_id = |&mut: installed_id: &CrateId| {
|
||||
lines_to_use.push(installed_id);
|
||||
//~^ ERROR cannot infer an appropriate lifetime for automatic coercion due to
|
||||
// conflicting requirements
|
||||
|
@ -38,7 +38,7 @@ pub fn remove_package_from_database() {
|
|||
|
||||
}
|
||||
|
||||
pub fn list_database(f: |&CrateId|) {
|
||||
pub fn list_database<F>(mut f: F) where F: FnMut(&CrateId) {
|
||||
let stuff = ["foo", "bar"];
|
||||
|
||||
for l in stuff.iter() {
|
||||
|
|
|
@ -57,9 +57,6 @@ fn test<'a,T,U:Copy>(_: &'a int) {
|
|||
// mutable object types are not ok
|
||||
assert_copy::<&'a mut (Dummy+Copy)>(); //~ ERROR `core::kinds::Copy` is not implemented
|
||||
|
||||
// closures are like an `&mut` object
|
||||
assert_copy::<||>(); //~ ERROR `core::kinds::Copy` is not implemented
|
||||
|
||||
// unsafe ptrs are ok
|
||||
assert_copy::<*const int>();
|
||||
assert_copy::<*const &'a mut int>();
|
||||
|
|
|
@ -27,14 +27,9 @@ fn box_object_with_no_bound_not_ok<'a>() {
|
|||
assert_send::<Box<Dummy>>(); //~ ERROR the trait `core::kinds::Send` is not implemented
|
||||
}
|
||||
|
||||
fn closure_with_no_bound_not_ok<'a>() {
|
||||
assert_send::<||:'static>(); //~ ERROR the trait `core::kinds::Send` is not implemented
|
||||
}
|
||||
|
||||
fn object_with_send_bound_ok() {
|
||||
assert_send::<&'static (Dummy+Send)>();
|
||||
assert_send::<Box<Dummy+Send>>();
|
||||
assert_send::<||:Send>;
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
|
|
@ -35,7 +35,7 @@ fn main() {
|
|||
_ => {}
|
||||
}
|
||||
|
||||
let x = |mut y: int| 10i; //~ ERROR: variable does not need to be mutable
|
||||
let x = |&: mut y: int| 10i; //~ ERROR: variable does not need to be mutable
|
||||
fn what(mut foo: int) {} //~ ERROR: variable does not need to be mutable
|
||||
|
||||
// positive cases
|
||||
|
@ -65,7 +65,7 @@ fn main() {
|
|||
_ => {}
|
||||
}
|
||||
|
||||
let x = |mut y: int| y = 32i;
|
||||
let x = |&mut: mut y: int| y = 32i;
|
||||
fn nothing(mut foo: int) { foo = 37i; }
|
||||
|
||||
// leading underscore should avoid the warning, just like the
|
||||
|
@ -73,7 +73,7 @@ fn main() {
|
|||
let mut _allowed = 1i;
|
||||
}
|
||||
|
||||
fn callback(f: ||) {}
|
||||
fn callback<F>(f: F) where F: FnOnce() {}
|
||||
|
||||
// make sure the lint attribute can be turned off
|
||||
#[allow(unused_mut)]
|
||||
|
|
|
@ -20,7 +20,7 @@ mod foo {
|
|||
}
|
||||
}
|
||||
|
||||
fn callback<T>(_f: || -> T) -> T { panic!() }
|
||||
fn callback<T, F>(_f: F) -> T where F: FnOnce() -> T { panic!() }
|
||||
unsafe fn unsf() {}
|
||||
|
||||
fn bad1() { unsafe {} } //~ ERROR: unnecessary `unsafe` block
|
||||
|
|
|
@ -8,5 +8,5 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn force(f: || -> int) -> int { f() }
|
||||
fn force<F>(f: F) -> int where F: FnOnce() -> int { f() }
|
||||
fn main() { println!("{}", force(|| {})); } //~ ERROR mismatched types
|
||||
|
|
|
@ -20,7 +20,7 @@ enum E {
|
|||
Baz
|
||||
}
|
||||
|
||||
fn f(s: &S, g: |&S|) {
|
||||
fn f<G>(s: &S, g: G) where G: FnOnce(&S) {
|
||||
g(s)
|
||||
}
|
||||
|
||||
|
|
|
@ -14,5 +14,5 @@ fn test(_x: Box<uint>) {}
|
|||
|
||||
fn main() {
|
||||
let i = box 3;
|
||||
let _f = || test(i); //~ ERROR cannot move out
|
||||
let _f = |&:| test(i); //~ ERROR cannot move out
|
||||
}
|
||||
|
|
|
@ -12,11 +12,13 @@
|
|||
// bound must be noncopyable. For details see
|
||||
// http://smallcultfollowing.com/babysteps/blog/2013/04/30/the-case-of-the-recurring-closure/
|
||||
|
||||
#![feature(unboxed_closures)]
|
||||
|
||||
struct R<'a> {
|
||||
// This struct is needed to create the
|
||||
// otherwise infinite type of a fn that
|
||||
// accepts itself as argument:
|
||||
c: |&mut R, bool|: 'a
|
||||
c: Box<FnMut(&mut R, bool) + 'a>
|
||||
}
|
||||
|
||||
fn innocent_looking_victim() {
|
||||
|
@ -27,8 +29,8 @@ fn innocent_looking_victim() {
|
|||
} else {
|
||||
match x {
|
||||
Some(ref msg) => {
|
||||
(f.c)(f, true);
|
||||
//~^ ERROR: cannot borrow `*f` as mutable because
|
||||
f.c.call_mut((f, true));
|
||||
//~^ ERROR: cannot borrow `*f` as mutable more than once at a time
|
||||
println!("{}", msg);
|
||||
},
|
||||
None => panic!("oops"),
|
||||
|
@ -37,8 +39,8 @@ fn innocent_looking_victim() {
|
|||
})
|
||||
}
|
||||
|
||||
fn conspirator(f: |&mut R, bool|) {
|
||||
let mut r = R {c: f};
|
||||
fn conspirator<F>(mut f: F) where F: FnMut(&mut R, bool) {
|
||||
let mut r = R {c: box f};
|
||||
f(&mut r, false) //~ ERROR use of moved value
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn let_in<T>(x: T, f: |T|) {}
|
||||
fn let_in<T, F>(x: T, f: F) where F: FnOnce(T) {}
|
||||
|
||||
fn main() {
|
||||
let_in(3u, |i| { assert!(i == 3i); });
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
let f = |3: int| println!("hello");
|
||||
let f = |&: 3: int| println!("hello");
|
||||
//~^ ERROR refutable pattern in function argument: `_` not covered
|
||||
f(4);
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn call_rec(f: |uint| -> uint) -> uint {
|
||||
(|x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f`
|
||||
fn call_rec<F>(mut f: F) -> uint where F: FnMut(uint) -> uint {
|
||||
(|&mut: x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f`
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
// Copyright 2013 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.
|
||||
|
||||
fn env<'a>(blk: |p: ||: 'a|) {
|
||||
// Test that the closure here cannot be assigned
|
||||
// the lifetime `'a`, which outlives the current
|
||||
// block.
|
||||
|
||||
let mut state = 0i;
|
||||
let statep = &mut state;
|
||||
blk(|| *statep = 1i); //~ ERROR captured variable `statep` does not outlive
|
||||
}
|
||||
|
||||
fn no_env_no_for<'a>(blk: |p: |||: 'a) {
|
||||
// Test that a closure with no free variables CAN
|
||||
// outlive the block in which it is created.
|
||||
|
||||
blk(|| ())
|
||||
}
|
||||
|
||||
fn repeating_loop() {
|
||||
// Test that the closure cannot be created within `loop` loop and
|
||||
// called without, even though the state that it closes over is
|
||||
// external to the loop.
|
||||
|
||||
let closure;
|
||||
let state = 0i;
|
||||
|
||||
loop {
|
||||
closure = || state; //~ ERROR cannot infer
|
||||
break;
|
||||
}
|
||||
|
||||
closure();
|
||||
}
|
||||
|
||||
fn repeating_while() {
|
||||
// Test that the closure cannot be created within `while` loop and
|
||||
// called without, even though the state that it closes over is
|
||||
// external to the loop.
|
||||
|
||||
let closure;
|
||||
let state = 0i;
|
||||
|
||||
while true {
|
||||
closure = || state; //~ ERROR cannot infer
|
||||
break;
|
||||
}
|
||||
|
||||
closure();
|
||||
}
|
||||
|
||||
fn main() {}
|
|
@ -16,7 +16,7 @@ struct dog {
|
|||
|
||||
impl dog {
|
||||
pub fn chase_cat(&mut self) {
|
||||
let _f = || {
|
||||
let _f = |&:| {
|
||||
let p: &'static mut uint = &mut self.food; //~ ERROR cannot infer
|
||||
*p = 3u;
|
||||
};
|
||||
|
|
|
@ -69,11 +69,6 @@ fn object_with_send_bound_not_ok<'a>() {
|
|||
//~^ ERROR declared lifetime bound not satisfied
|
||||
}
|
||||
|
||||
fn closure_with_lifetime_not_ok<'a>() {
|
||||
assert_send::<||:'a>();
|
||||
//~^ ERROR not implemented
|
||||
}
|
||||
|
||||
// unsafe pointers are ok unless they point at unsendable things
|
||||
|
||||
struct UniqueUnsafePtr(Unique<*const int>);
|
||||
|
|
|
@ -27,14 +27,14 @@ fn compute(x: &ast) -> uint {
|
|||
}
|
||||
}
|
||||
|
||||
fn map_nums<'a,'b>(x: &ast, f: |uint| -> uint) -> &'a ast<'b> {
|
||||
fn map_nums<'a,'b, F>(x: &ast, f: &mut F) -> &'a ast<'b> where F: FnMut(uint) -> uint {
|
||||
match *x {
|
||||
ast::num(x) => {
|
||||
return &ast::num(f(x)); //~ ERROR borrowed value does not live long enough
|
||||
return &ast::num((*f)(x)); //~ ERROR borrowed value does not live long enough
|
||||
}
|
||||
ast::add(x, y) => {
|
||||
let m_x = map_nums(x, |z| f(z));
|
||||
let m_y = map_nums(y, |z| f(z));
|
||||
let m_x = map_nums(x, f);
|
||||
let m_y = map_nums(y, f);
|
||||
return &ast::add(m_x, m_y); //~ ERROR borrowed value does not live long enough
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn with_int(f: |x: &int|) {
|
||||
fn with_int<F>(f: F) where F: FnOnce(&int) {
|
||||
let x = 3;
|
||||
f(&x);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn with_int(f: |x: &int|) {
|
||||
fn with_int<F>(f: F) where F: FnOnce(&int) {
|
||||
let x = 3;
|
||||
f(&x);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
struct S;
|
||||
|
||||
impl S {
|
||||
fn f<B>(&self, _: |&i32| -> B) {
|
||||
fn f<B, F>(&self, _: F) where F: FnOnce(&i32) -> B {
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ impl<'a> Deref for &'a int {
|
|||
}
|
||||
}
|
||||
|
||||
fn with<R:Deref>(f: |x: &int| -> R) -> int {
|
||||
fn with<R:Deref, F>(f: F) -> int where F: FnOnce(&int) -> R {
|
||||
f(&3).get()
|
||||
}
|
||||
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
// Copyright 2012 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.
|
||||
|
||||
fn of<'a,T>() -> |T|:'a { panic!(); }
|
||||
fn subtype<T>(x: |T|) { panic!(); }
|
||||
|
||||
fn test_fn<'x,'y,'z,T>(_x: &'x T, _y: &'y T, _z: &'z T) {
|
||||
// Here, x, y, and z are free. Other letters
|
||||
// are bound. Note that the arrangement
|
||||
// subtype::<T1>(of::<T2>()) will typecheck
|
||||
// iff T1 <: T2.
|
||||
|
||||
subtype::< for<'a>|&'a T|>(
|
||||
of::< for<'a>|&'a T|>());
|
||||
|
||||
subtype::< for<'a>|&'a T|>(
|
||||
of::< for<'b>|&'b T|>());
|
||||
|
||||
subtype::< for<'b>|&'b T|>(
|
||||
of::<|&'x T|>());
|
||||
|
||||
subtype::<|&'x T|>(
|
||||
of::< for<'b>|&'b T|>()); //~ ERROR mismatched types
|
||||
|
||||
subtype::< for<'a,'b>|&'a T, &'b T|>(
|
||||
of::< for<'a>|&'a T, &'a T|>());
|
||||
|
||||
subtype::< for<'a>|&'a T, &'a T|>(
|
||||
of::< for<'a,'b>|&'a T, &'b T|>()); //~ ERROR mismatched types
|
||||
|
||||
subtype::< for<'a,'b>|&'a T, &'b T|>(
|
||||
of::<|&'x T, &'y T|>());
|
||||
|
||||
subtype::<|&'x T, &'y T|>(
|
||||
of::< for<'a,'b>|&'a T, &'b T|>()); //~ ERROR mismatched types
|
||||
}
|
||||
|
||||
fn main() {}
|
|
@ -1,21 +0,0 @@
|
|||
// Copyright 2012 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.
|
||||
|
||||
// Before fn subtyping was properly implemented,
|
||||
// we reported errors in this case:
|
||||
|
||||
fn not_ok<'b>(a: &uint, b: &'b uint) {
|
||||
let mut g: |x: &uint| = |x: &'b uint| {};
|
||||
//~^ ERROR mismatched types
|
||||
g(a);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
}
|
|
@ -30,7 +30,7 @@ fn ordering3<'a, 'b>(x: &'a uint, y: &'b uint) -> &'a &'b uint {
|
|||
panic!();
|
||||
}
|
||||
|
||||
fn ordering4<'a, 'b>(a: &'a uint, b: &'b uint, x: |&'a &'b uint|) {
|
||||
fn ordering4<'a, 'b, F>(a: &'a uint, b: &'b uint, x: F) where F: FnOnce(&'a &'b uint) {
|
||||
// Do not infer ordering from closure argument types.
|
||||
let z: Option<&'a &'b uint> = None;
|
||||
//~^ ERROR reference has a longer lifetime than the data it references
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
// Copyright 2012 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.
|
||||
|
||||
fn wants_static_fn(_x: ||: 'static) {}
|
||||
|
||||
fn main() {
|
||||
let i = 3i;
|
||||
wants_static_fn(|| {
|
||||
println!("i={}", i); //~ ERROR captured variable `i` does not outlive
|
||||
})
|
||||
}
|
|
@ -9,15 +9,15 @@
|
|||
// except according to those terms.
|
||||
|
||||
struct parameterized1<'a> {
|
||||
g: ||: 'a
|
||||
g: Box<FnMut() + 'a>
|
||||
}
|
||||
|
||||
struct not_parameterized1 {
|
||||
g: ||: 'static
|
||||
g: Box<FnMut() + 'static>
|
||||
}
|
||||
|
||||
struct not_parameterized2 {
|
||||
g: ||: 'static
|
||||
g: Box<FnMut() + 'static>
|
||||
}
|
||||
|
||||
fn take1<'a>(p: parameterized1) -> parameterized1<'a> { p }
|
||||
|
|
|
@ -11,7 +11,10 @@
|
|||
|
||||
fn borrow<T>(x: &T) -> &T {x}
|
||||
|
||||
fn foo(cond: || -> bool, make_box: || -> Box<int>) {
|
||||
fn foo<C, M>(mut cond: C, mut make_box: M) where
|
||||
C: FnMut() -> bool,
|
||||
M: FnMut() -> Box<int>,
|
||||
{
|
||||
let mut y: ∫
|
||||
loop {
|
||||
let x = make_box();
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
fn select<'r>(x: &'r int, y: &'r int) -> &'r int { x }
|
||||
|
||||
fn with<T>(f: |x: &int| -> T) -> T {
|
||||
fn with<T, F>(f: F) -> T where F: FnOnce(&int) -> T {
|
||||
f(&20)
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
|
||||
struct invariant<'a> {
|
||||
f: |x: &mut &'a int|: 'static
|
||||
f: Box<FnOnce(&mut &'a int) + 'static>,
|
||||
}
|
||||
|
||||
fn to_same_lifetime<'r>(bi: invariant<'r>) {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
|
||||
struct invariant<'a> {
|
||||
f: ||: 'static -> &mut &'a int
|
||||
f: Box<for<'b> FnOnce() -> &'b mut &'a int + 'static>,
|
||||
}
|
||||
|
||||
fn to_same_lifetime<'r>(bi: invariant<'r>) {
|
||||
|
|
|
@ -14,12 +14,12 @@ struct direct<'a> {
|
|||
|
||||
struct indirect1 {
|
||||
// Here the lifetime parameter of direct is bound by the fn()
|
||||
g: |direct|: 'static
|
||||
g: Box<FnOnce(direct) + 'static>
|
||||
}
|
||||
|
||||
struct indirect2<'a> {
|
||||
// But here it is set to 'a
|
||||
g: |direct<'a>|: 'static
|
||||
g: Box<FnOnce(direct<'a>) + 'static>
|
||||
}
|
||||
|
||||
fn take_direct<'a,'b>(p: direct<'a>) -> direct<'b> { p } //~ ERROR mismatched types
|
||||
|
|
|
@ -43,19 +43,16 @@ fn bar<'a>(x: &'a int) {
|
|||
|
||||
// &'a CAN be declared on functions and used then:
|
||||
fn g<'a>(a: &'a int) { } // OK
|
||||
fn h(a: for<'a>|&'a int|) { } // OK
|
||||
|
||||
// But not in the bound of a closure, it's not in scope *there*
|
||||
fn i(a: for<'a>|&int|:'a) { } //~ ERROR undeclared lifetime
|
||||
fn h(a: Box<for<'a> FnOnce(&'a int)>) { } // OK
|
||||
}
|
||||
|
||||
// Test nesting of lifetimes in fn type declarations
|
||||
fn fn_types(a: &'a int, //~ ERROR undeclared lifetime
|
||||
b: for<'a>|a: &'a int,
|
||||
b: &'b int, //~ ERROR undeclared lifetime
|
||||
c: for<'b>|a: &'a int,
|
||||
b: &'b int|,
|
||||
d: &'b int|, //~ ERROR undeclared lifetime
|
||||
b: Box<for<'a> FnOnce(&'a int,
|
||||
&'b int, //~ ERROR undeclared lifetime
|
||||
Box<for<'b> FnOnce(&'a int,
|
||||
&'b int)>,
|
||||
&'b int)>, //~ ERROR undeclared lifetime
|
||||
c: &'a int) //~ ERROR undeclared lifetime
|
||||
{
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn ignore(_f: for<'z>|&'z int| -> &'z int) {}
|
||||
fn ignore<F>(_f: F) where F: for<'z> FnOnce(&'z int) -> &'z int {}
|
||||
|
||||
fn nested() {
|
||||
let y = 3;
|
||||
|
|
|
@ -14,13 +14,13 @@ fn nested<'x>(x: &'x int) {
|
|||
let y = 3;
|
||||
let mut ay = &y;
|
||||
|
||||
ignore::< for<'z>|&'z int|>(|z| {
|
||||
ignore::<Box<for<'z> FnMut(&'z int)>>(box |z| {
|
||||
ay = x; //~ ERROR cannot infer
|
||||
ay = &y;
|
||||
ay = z;
|
||||
});
|
||||
|
||||
ignore::< for<'z>|&'z int| -> &'z int>(|z| {
|
||||
ignore::< Box<for<'z> FnMut(&'z int) -> &'z int>>(box |z| {
|
||||
if false { return x; } //~ ERROR cannot infer an appropriate lifetime for automatic
|
||||
if false { return ay; }
|
||||
return z;
|
||||
|
|
|
@ -13,7 +13,7 @@ fn arg_item(box ref x: Box<int>) -> &'static int {
|
|||
x //~^ ERROR borrowed value does not live long enough
|
||||
}
|
||||
|
||||
fn with<R>(f: |Box<int>| -> R) -> R { f(box 3) }
|
||||
fn with<R, F>(f: F) -> R where F: FnOnce(Box<int>) -> R { f(box 3) }
|
||||
|
||||
fn arg_closure() -> &'static int {
|
||||
with(|box ref x| x) //~ ERROR borrowed value does not live long enough
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// some point regions-ret-borrowed reported an error but this file did
|
||||
// not, due to special hardcoding around the anonymous region.
|
||||
|
||||
fn with<R>(f: for<'a>|x: &'a int| -> R) -> R {
|
||||
fn with<R, F>(f: F) -> R where F: for<'a> FnOnce(&'a int) -> R {
|
||||
f(&3)
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
// used to successfully compile because we failed to account for the
|
||||
// fact that fn(x: &int) rebound the region &.
|
||||
|
||||
fn with<R>(f: |x: &int| -> R) -> R {
|
||||
fn with<R, F>(f: F) -> R where F: FnOnce(&int) -> R {
|
||||
f(&3)
|
||||
}
|
||||
|
||||
|
|
|
@ -20,11 +20,4 @@ fn main() {
|
|||
let x = f();
|
||||
let y = f();
|
||||
}
|
||||
// Boxed closure case
|
||||
{
|
||||
let mut x = 0u;
|
||||
let f = || &mut x; //~ ERROR cannot infer
|
||||
let x = f();
|
||||
let y = f();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,18 +8,20 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(unboxed_closures)]
|
||||
|
||||
struct closure_box<'a> {
|
||||
cl: ||: 'a
|
||||
cl: Box<FnMut() + 'a>,
|
||||
}
|
||||
|
||||
fn box_it<'r>(x: ||: 'r) -> closure_box<'r> {
|
||||
fn box_it<'r>(x: Box<FnMut() + 'r>) -> closure_box<'r> {
|
||||
closure_box {cl: x}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let cl_box = {
|
||||
let mut i = 3;
|
||||
box_it(|| i += 1) //~ ERROR cannot infer
|
||||
let mut i = 3i;
|
||||
box_it(box || i += 1) //~ ERROR cannot infer
|
||||
};
|
||||
(cl_box.cl)();
|
||||
cl_box.cl.call_mut(());
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue