rust/compiler/rustc_borrowck
Matthias Krüger 8de487fdbd
Rollup merge of #124599 - estebank:issue-41708, r=wesleywiser
Suggest borrowing on fn argument that is `impl AsRef`

When encountering a move conflict, on an expression that is `!Copy` passed as an argument to an `fn` that is `impl AsRef`, suggest borrowing the expression.

```
error[E0382]: use of moved value: `bar`
  --> f204.rs:14:15
   |
12 |     let bar = Bar;
   |         --- move occurs because `bar` has type `Bar`, which does not implement the `Copy` trait
13 |     foo(bar);
   |         --- value moved here
14 |     let baa = bar;
   |               ^^^ value used here after move
   |
help: borrow the value to avoid moving it
   |
13 |     foo(&bar);
   |         +
```

Fix #41708
2024-07-11 17:01:36 +02:00
..
src Rollup merge of #124599 - estebank:issue-41708, r=wesleywiser 2024-07-11 17:01:36 +02:00
Cargo.toml bump itertools to 0.12 2024-03-08 12:34:05 +03:00
messages.ftl Better account for FnOnce in move errors 2024-04-11 16:41:42 +00:00