diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-04-29 12:23:15 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-29 12:23:15 +0200 |
| commit | d0ff2295e071a25568bb21f47287e7f76468591a (patch) | |
| tree | d03d4f09a48ee98451c5d40b89ab00acbf6752c4 /src/test/debuginfo/enum-thinlto.rs | |
| parent | 92019986aa6532256277ca999006bdc77e9a95ad (diff) | |
| parent | 2c6094e5d043087e6f7539bd5d484ff3ba4dcf5d (diff) | |
| download | rust-d0ff2295e071a25568bb21f47287e7f76468591a.tar.gz rust-d0ff2295e071a25568bb21f47287e7f76468591a.zip | |
Rollup merge of #71217 - estebank:tail-borrow-sugg, r=pnkfelix
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/test/debuginfo/enum-thinlto.rs')
0 files changed, 0 insertions, 0 deletions
