about summary refs log tree commit diff
path: root/src/test/debuginfo/enum-thinlto.rs
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2020-04-16 12:43:40 -0700
committerEsteban Küber <esteban@kuber.com.ar>2020-04-28 18:47:06 -0700
commit2c6094e5d043087e6f7539bd5d484ff3ba4dcf5d (patch)
treea8f219ca7b8eb645563e541ddefeceafe6a5f0c0 /src/test/debuginfo/enum-thinlto.rs
parent8ce3f840ae9b735a66531996c32330f24b877cb0 (diff)
downloadrust-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/test/debuginfo/enum-thinlto.rs')
0 files changed, 0 insertions, 0 deletions