error[E0308]: mismatched types --> $DIR/coerce-suggestions.rs:7:20 | LL | let x: usize = String::new(); | ^^^^^^^^^^^^^ expected usize, found struct `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()` error[E0308]: mismatched types --> $DIR/coerce-suggestions.rs:12:10 | LL | test(&y); | ^^ types differ in mutability | = note: expected mutable reference `&mut std::string::String` found reference `&std::string::String` error[E0308]: mismatched types --> $DIR/coerce-suggestions.rs:14:11 | LL | test2(&y); | ^^ types differ in mutability | = note: expected mutable reference `&mut i32` found reference `&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 &mut std::string::String, found struct `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`.