error[E0308]: mismatched types --> $DIR/coerce-suggestions.rs:7:20 | LL | let x: usize = String::new(); | ----- ^^^^^^^^^^^^^ expected `usize`, found struct `String` | | | expected due to this error[E0308]: mismatched types --> $DIR/coerce-suggestions.rs:9:19 | LL | let x: &str = String::new(); | ---- ^^^^^^^^^^^^^ | | | | | expected `&str`, found struct `String` | | help: consider borrowing here: `&String::new()` | expected due to this error[E0308]: mismatched types --> $DIR/coerce-suggestions.rs:12:10 | LL | test(&y); | ^^ types differ in mutability | = note: expected mutable reference `&mut String` found reference `&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 `&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 | LL | f = (box f).to_string(); | + +++++++++++++ error[E0308]: mismatched types --> $DIR/coerce-suggestions.rs:21:9 | LL | s = format!("foo"); | ^^^^^^^^^^^^^^ expected `&mut String`, found struct `String` | = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0308`.