rust/src/test/ui/conversion-methods.stderr
Yuning Zhang 710dcbd381 Improve type mismatch error messages
Replace "integral variable" with "integer" and replace
"floating-point variable" with "floating-point number" to make the
message less confusing.
2018-12-31 20:43:08 -05:00

52 lines
2.4 KiB
Plaintext

error[E0308]: mismatched types
--> $DIR/conversion-methods.rs:5: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:6: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:9:40
|
LL | let _but_should_the_play: String = 2; // Perhaps surprisingly, we suggest .to_string() here
| ^
| |
| expected struct `std::string::String`, found integer
| 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:12:47
|
LL | let _prove_piercing_earnest: Vec<usize> = &[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<usize>`
found type `&[{integer}; 3]`
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0308`.