rust/tests/ui/borrowck/borrowck-consume-upcast-box.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

15 lines
243 B
Rust
Raw Normal View History

// Check that we report an error if an upcast box is moved twice.
trait Foo { fn dummy(&self); }
2019-05-28 18:46:13 +00:00
fn consume(_: Box<dyn Foo>) {
}
2019-05-28 18:46:13 +00:00
fn foo(b: Box<dyn Foo + Send>) {
consume(b);
consume(b); //~ ERROR use of moved value
}
fn main() {
}