Closed
Description
Given the following code: Playground
pub struct Foo;
fn fun(foo: &mut Vec<Foo>, bar: &[Foo]) {
foo.extend_from_slice(bar);
}
The current output is:
error[E0599]: the method `extend_from_slice` exists for mutable reference `&mut Vec<Foo>`, but its trait bounds were not satisfied
--> src/lib.rs:3:9
|
1 | pub struct Foo;
| ---------------------- doesn't satisfy `Foo: Clone`
2 | fn fun(foo: &mut Vec<Foo>, bar: &[Foo]) {
3 | foo.extend_from_slice(bar);
| ^^^^^^^^^^^^^^^^^
|
= note: the following trait bounds were not satisfied:
`Foo: Clone`
help: consider annotating `Foo` with `#[derive(Clone, Clone)]`
|
1 | #[derive(Clone, Clone)]
|
For more information about this error, try `rustc --explain E0599`.
error: could not compile `playground` due to previous error
Ideally the output should look like:
error[E0599]: the method `extend_from_slice` exists for mutable reference `&mut Vec<Foo>`, but its trait bounds were not satisfied
--> src/lib.rs:3:9
|
1 | pub struct Foo;
| ---------------------- doesn't satisfy `Foo: Clone`
2 | fn fun(foo: &mut Vec<Foo>, bar: &[Foo]) {
3 | foo.extend_from_slice(bar);
| ^^^^^^^^^^^^^^^^^
|
= note: the following trait bounds were not satisfied:
`Foo: Clone`
help: consider annotating `Foo` with `#[derive(Clone)]`
|
1 | #[derive(Clone)]
|
For more information about this error, try `rustc --explain E0599`.
error: could not compile `playground` due to previous error