error[E0308]: mismatched types --> $DIR/coerce-suggestions.rs:7:20 | LL | let x: usize = String::new(); | ^^^^^^^^^^^^^ expected usize, found struct `std::string::String` | = note: expected type `usize` found type `std::string::String` error[E0308]: mismatched types --> $DIR/coerce-suggestions.rs:9:19 | LL | let x: &str = String::new(); | ^^^^^^^^^^^^^ | | | expected &str, found struct `std::string::String` | help: consider borrowing here: `&String::new()` | = note: expected type `&str` found type `std::string::String` error[E0308]: mismatched types --> $DIR/coerce-suggestions.rs:12:10 | LL | test(&y); | ^^ types differ in mutability | = note: expected type `&mut std::string::String` found type `&std::string::String` error[E0308]: mismatched types --> $DIR/coerce-suggestions.rs:14:11 | LL | test2(&y); | ^^ types differ in mutability | = note: expected type `&mut i32` found type `&std::string::String` error[E0308]: mismatched types --> $DIR/coerce-suggestions.rs:17:9 | LL | f = box f; | ^^^^^ | | | cyclic type of infinite size | help: try using a conversion method: `box f.to_string()` error[E0308]: mismatched types --> $DIR/coerce-suggestions.rs:21:9 | LL | s = format!("foo"); | ^^^^^^^^^^^^^^ expected mutable reference, found struct `std::string::String` | = note: expected type `&mut std::string::String` found type `std::string::String` = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0308`.