diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2020-04-16 12:43:40 -0700 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2020-04-28 18:47:06 -0700 |
| commit | 2c6094e5d043087e6f7539bd5d484ff3ba4dcf5d (patch) | |
| tree | a8f219ca7b8eb645563e541ddefeceafe6a5f0c0 /src/rustllvm/RustWrapper.cpp | |
| parent | 8ce3f840ae9b735a66531996c32330f24b877cb0 (diff) | |
| download | rust-2c6094e5d043087e6f7539bd5d484ff3ba4dcf5d.tar.gz rust-2c6094e5d043087e6f7539bd5d484ff3ba4dcf5d.zip | |
Suggest `;` or assignment to drop borrows in tail exprs
Address the diagnostics part of #70844.
```
error[E0597]: `counter` does not live long enough
--> $DIR/issue-54556-niconii.rs:22:20
|
LL | if let Ok(_) = counter.lock() { }
| ^^^^^^^-------
| |
| borrowed value does not live long enough
| a temporary with access to the borrow is created here ...
...
LL | }
| -
| |
| `counter` dropped here while still borrowed
| ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `std::result::Result<MutexGuard<'_>, ()>`
|
help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
|
LL | if let Ok(_) = counter.lock() { };
| ^
```
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
