about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/errors.rs
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2024-12-31 17:33:45 +0000
committerEsteban Küber <esteban@kuber.com.ar>2025-01-11 01:34:23 +0000
commitec98df4bb6839d017911444499557ecb73e39a00 (patch)
tree0fa36a3dd70adf4ba55e383de9a7b3ca6cfce3cc /compiler/rustc_codegen_llvm/src/errors.rs
parentc2ae386c851b9f85439375dc788a506e2482ca60 (diff)
downloadrust-ec98df4bb6839d017911444499557ecb73e39a00.tar.gz
rust-ec98df4bb6839d017911444499557ecb73e39a00.zip
On unused assign lint, detect `mut arg: &Ty` meant to be `arg: &mut Ty`
```
error: value assigned to `object` is never read
  --> $DIR/mut-arg-of-borrowed-type-meant-to-be-arg-of-mut-borrow.rs:11:5
   |
LL |     object = &object2;
   |     ^^^^^^
   |
note: the lint level is defined here
  --> $DIR/mut-arg-of-borrowed-type-meant-to-be-arg-of-mut-borrow.rs:1:9
   |
LL | #![deny(unused_assignments, unused_variables)]
   |         ^^^^^^^^^^^^^^^^^^
help: you might have meant to mutate the pointed at value being passed in, instead of changing the reference in the local binding
   |
LL ~ fn change_object2(object: &mut Object) {
LL |     let object2 = Object;
LL ~     *object = object2;
   |
```

This might be the first thing someone tries to write to mutate the value *behind* an argument, trying to avoid an E0308.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/errors.rs')
0 files changed, 0 insertions, 0 deletions