mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-04 11:17:04 +00:00

Fix suggestion for removing &mut from &mut macro!(). Fixes #85933 Before: (Note the suggestions.) ``` error[E0308]: mismatched types --> src/main.rs:2:21 | 2 | let _: String = &mut format!(""); | ------ ^^^^^^^^^^^^^^^^ | | | | | expected struct `String`, found `&mut String` | | help: consider removing the borrow: `mut format!("")` | expected due to this error[E0308]: mismatched types --> src/main.rs:3:21 | 3 | let _: String = &mut (format!("")); | ------ ^^^^^^^^^^^^^^^^^^ | | | | | expected struct `String`, found `&mut String` | | help: consider removing the borrow: `mut (format!(""))` | expected due to this ``` After: ``` error[E0308]: mismatched types --> src/main.rs:2:21 | 2 | let _: String = &mut format!(""); | ------ ^^^^^^^^^^^^^^^^ | | | | | expected struct `String`, found `&mut String` | | help: consider removing the borrow: `format!("")` | expected due to this error[E0308]: mismatched types --> src/main.rs:3:21 | 3 | let _: String = &mut (format!("")); | ------ ^^^^^^^^^^^^^^^^^^ | | | | | expected struct `String`, found `&mut String` | | help: consider removing the borrow: `format!("")` | expected due to this ```
For high-level intro to how type checking works in rustc, see the type checking chapter of the rustc dev guide.