Closed
Description
Hey all,
With the following piece of code (rust playground):
struct Foo {}
struct Bar {}
fn hey(pouet: Vec<Bar>){}
fn main() {
let foo = vec![Foo {}];
hey(foo);
}
rustc gives me the following error
error[E0308]: mismatched types
--> a.rs:8:9
|
8 | hey(foo);
| ^^^ expected struct `Bar`, found struct `Foo`
|
= note: expected type `std::vec::Vec<Bar>`
found type `std::vec::Vec<Foo>`
= help: here are some functions which might fulfill your needs:
- .to_vec()
which doesn't make sense since .to_vec()
wouldn't in any case convert the inner type.