-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// 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. | ||
// | ||
This comment has been minimized.
Sorry, something went wrong. |
||
// 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 bar(_blk: &fn:Copy()) { | ||
} | ||
|
||
fn foo(blk: &fn()) { | ||
bar(blk); //~ ERROR expected bounds `Copy` but found no bounds | ||
} | ||
|
||
fn main() { | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// 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 bar(_blk: &fn:Const+Owned()) { | ||
} | ||
|
||
fn foo(blk: &fn:Copy+Owned()) { | ||
bar(blk); //~ ERROR expected bounds `Owned+Const` but found bounds `Copy+Owned` | ||
This comment has been minimized.
Sorry, something went wrong. |
||
} | ||
|
||
fn main() { | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// 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. | ||
|
||
struct X { | ||
field: @fn:Copy(), | ||
} | ||
|
||
fn foo(blk: @fn()) -> X { | ||
return X { field: blk }; //~ ERROR expected bounds `Copy` but found no bounds | ||
} | ||
|
||
fn main() { | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// 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. | ||
|
||
use std::comm; | ||
|
||
fn foo(blk: ~fn:Copy()) { | ||
blk(); | ||
} | ||
|
||
fn main() { | ||
let (p,c) = comm::stream(); | ||
do foo { // shouldn't be legal | ||
c.send(()); //~ ERROR cannot capture variable of type `std::comm::Chan<()>`, which does not fulfill `Copy`, in a bounded closure | ||
//~^ NOTE this closure's environment must satisfy `Copy` | ||
This comment has been minimized.
Sorry, something went wrong.
nikomatsakis
|
||
} | ||
p.recv(); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// 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 bar(blk: &fn:'static()) { | ||
} | ||
|
||
fn foo(x: &()) { | ||
do bar { | ||
let _ = x; //~ ERROR cannot capture variable of type `&()`, which does not fulfill `'static`, in a bounded closure | ||
This comment has been minimized.
Sorry, something went wrong. |
||
//~^ NOTE this closure's environment must satisfy `'static` | ||
} | ||
} | ||
|
||
fn main() { | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// 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. | ||
|
||
use std::comm; | ||
|
||
fn foo(blk: ~fn:Owned()) { | ||
blk(); | ||
} | ||
|
||
fn main() { | ||
let (p,c) = comm::stream(); | ||
do foo { // shouldn't be legal | ||
This comment has been minimized.
Sorry, something went wrong. |
||
c.send(()); | ||
} | ||
p.recv(); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// 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 bar(_blk: &fn()) { | ||
} | ||
|
||
fn foo(blk: &fn:Copy()) { | ||
bar(blk); | ||
} | ||
|
||
fn main() { | ||
This comment has been minimized.
Sorry, something went wrong.
nikomatsakis
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// 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 bar(_blk: &fn:Const+Owned()) { | ||
} | ||
|
||
fn foo(blk: &fn:Const+Copy+Owned()) { | ||
bar(blk); | ||
This comment has been minimized.
Sorry, something went wrong. |
||
} | ||
|
||
fn main() { | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// 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. | ||
|
||
struct X { | ||
field: @fn(), | ||
} | ||
|
||
fn foo(blk: @fn:Copy()) -> X { | ||
return X { field: blk }; | ||
This comment has been minimized.
Sorry, something went wrong. |
||
} | ||
|
||
fn main() { | ||
} |
This test is not needed, see
closure-bounds-subtype.rs