Skip to content

Conversation

estebank
Copy link
Contributor

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() { };
   |                                      ^

@rust-highfive
Copy link
Contributor

r? @cramertj

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 16, 2020
@estebank
Copy link
Contributor Author

cc @pnkfelix

@bors

This comment has been minimized.

@joelpalmer joelpalmer added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 28, 2020
@Dylan-DPC-zz
Copy link

r? @pnkfelix

@rust-highfive rust-highfive assigned pnkfelix and unassigned cramertj Apr 28, 2020
@pnkfelix
Copy link
Contributor

r=me once the nit is addressed.

@pnkfelix pnkfelix added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 28, 2020
@pnkfelix
Copy link
Contributor

cc #46413 (I guess I was wrong, there was more to be done here. 😉 )

Address the diagnostics part of rust-lang#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() { };
   |                                      ^
```
@estebank
Copy link
Contributor Author

@bors r=pnkfelix

@bors
Copy link
Collaborator

bors commented Apr 29, 2020

📌 Commit 2c6094e has been approved by pnkfelix

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 29, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 29, 2020
Rollup of 5 pull requests

Successful merges:

 - rust-lang#71217 (Suggest `;` or assignment to drop borrows in tail exprs)
 - rust-lang#71286 (Add regression test for rust-lang#69654)
 - rust-lang#71296 (Change wording on read_vectored docs)
 - rust-lang#71654 (Update link to unstable book for llvm_asm macro)
 - rust-lang#71657 (Add rust-lang#24949 assoc constant static recursion test)

Failed merges:

r? @ghost
@bors bors merged commit d0ff229 into rust-lang:master Apr 29, 2020
@estebank estebank deleted the tail-borrow-sugg branch November 9, 2023 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants