rust/src/test/compile-fail/kindck-owned-trait.rs

12 lines
218 B
Rust
Raw Normal View History

trait foo { fn foo(); }
fn to_foo<T: copy foo>(t: T) -> foo {
t as foo //~ ERROR value may contain borrowed pointers; use `owned` bound
}
fn to_foo2<T: copy foo owned>(t: T) -> foo {
t as foo
}
fn main() {}