Skip to content

Instantly share code, notes, and snippets.

@woss
Created March 20, 2020 18:30
Show Gist options
  • Save woss/5c43cec1780df884898703b4d7eb3188 to your computer and use it in GitHub Desktop.
Save woss/5c43cec1780df884898703b4d7eb3188 to your computer and use it in GitHub Desktop.
! Compiling of exercises/traits/traits2.rs failed! Please try again. Here's the output:
error[E0308]: mismatched types
--> exercises/traits/traits2.rs:21:9
|
19 | fn append_bar(&mut self) -> Self {
| ---- expected `std::vec::Vec<std::string::String>` because of return type
20 | self.push(String::from("Bar"));
21 | self
| ^^^^
| |
| expected struct `std::vec::Vec`, found mutable reference
| help: try using a conversion method: `self.to_vec()`
|
= note: expected struct `std::vec::Vec<std::string::String>`
found mutable reference `&mut std::vec::Vec<std::string::String>`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.
Type 'hint' to get help
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment