Closed
Description
Non-copyable types as type parameters for copyable types cause them to be non-copyable.
struct NonCopyable(uint, uint);
#[derive(Copy)]
struct Copyable<T>(uint);
fn foo(c: Copyable<NonCopyable>){
foo(c);
foo(c);
}
fn main() {}
this results in
<anon>:8:9: 8:10 error: use of moved value: `c`
<anon>:8 foo(c);
^
<anon>:7:9: 7:10 note: `c` moved here because it has type `Copyable<NonCopyable>`, which is non-copyable
<anon>:7 foo(c);
replacing T for Copyable with a copyable type, it compiles fine
#[derive(Copy)]
struct Copyable<T>(uint);
fn foo(c: Copyable<bool>){
foo(c);
foo(c);
}
fn main(){}
rustc 1.0.0-nightly (44a287e6e 2015-01-08 17:03:40 -0800)
Metadata
Metadata
Assignees
Labels
No labels