about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc/example/std_example.rs
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2024-05-02 01:15:40 +0000
committerEsteban Küber <esteban@kuber.com.ar>2024-05-09 23:25:31 +0000
commit2df4f7dd8c51e1c3e65b615d1c44fdc9d0b4b044 (patch)
tree3fbc86ced21974cfa630dc4ebc185dee45064c45 /compiler/rustc_codegen_gcc/example/std_example.rs
parente6e262f1250e6978eea528ee8c391786c9b4f44e (diff)
downloadrust-2df4f7dd8c51e1c3e65b615d1c44fdc9d0b4b044.tar.gz
rust-2df4f7dd8c51e1c3e65b615d1c44fdc9d0b4b044.zip
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
Diffstat (limited to 'compiler/rustc_codegen_gcc/example/std_example.rs')
0 files changed, 0 insertions, 0 deletions