Commit Graph

5 Commits

Author SHA1 Message Date
Esteban Küber
2c6094e5d0 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() { };
   |                                      ^
```
2020-04-28 18:47:06 -07:00
Matthew Jasper
8eef102270 update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
Vadim Petrochenkov
fa72a81bea Update tests 2019-03-11 23:10:26 +03:00
Oliver Scherer
61efc3b71b Update tests 2018-12-04 10:06:05 +01:00
Felix S. Klock II
056cfffd1b Unit tests for issue #54556. Some were also taken from issues #21114, #46413. 2018-10-05 12:04:53 +02:00