]> git.lizzy.rs Git - rust.git/commit - src/tools/rust-analyzer
Rollup merge of #85939 - m-ou-se:fix-remove-ref-macro-invocation, r=estebank
authorYuki Okushi <jtitor@2k36.org>
Fri, 4 Jun 2021 21:13:39 +0000 (06:13 +0900)
committerGitHub <noreply@github.com>
Fri, 4 Jun 2021 21:13:39 +0000 (06:13 +0900)
commit5ebc4d3697ee12a1484ebc28d0e18d69834b7154
treed85d0d4532ae16e933406e5fcbaa7e80de612de2
parentec9e7d5df1f3cec1889573f9fb470c174cf96dfa
parentecebb669d5fa442b903a3a17f72cbf2268a5a080
Rollup merge of #85939 - m-ou-se:fix-remove-ref-macro-invocation, r=estebank

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
```
compiler/rustc_typeck/src/check/demand.rs