error[E0308]: mismatched types --> $DIR/conversion-methods.rs:15:41 | LL | let _tis_an_instants_play: String = "'Tis a fond Ambush—"; //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^^^^^^ | | | expected struct `std::string::String`, found reference | help: try using a conversion method: `"'Tis a fond Ambush—".to_string()` | = note: expected type `std::string::String` found type `&'static str` error[E0308]: mismatched types --> $DIR/conversion-methods.rs:16:40 | LL | let _just_to_make_bliss: PathBuf = Path::new("/ern/her/own/surprise"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | expected struct `std::path::PathBuf`, found reference | help: try using a conversion method: `Path::new("/ern/her/own/surprise").to_path_buf()` | = note: expected type `std::path::PathBuf` found type `&std::path::Path` error[E0308]: mismatched types --> $DIR/conversion-methods.rs:19:40 | LL | let _but_should_the_play: String = 2; // Perhaps surprisingly, we suggest .to_string() here | ^ | | | expected struct `std::string::String`, found integral variable | help: try using a conversion method: `2.to_string()` | = note: expected type `std::string::String` found type `{integer}` error[E0308]: mismatched types --> $DIR/conversion-methods.rs:22:47 | LL | let _prove_piercing_earnest: Vec = &[1, 2, 3]; //~ ERROR mismatched types | ^^^^^^^^^^ | | | expected struct `std::vec::Vec`, found reference | help: try using a conversion method: `&[1, 2, 3].to_vec()` | = note: expected type `std::vec::Vec` found type `&[{integer}; 3]` error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0308`.