Skip to content

[significant_drop_tightening] Evaluate the return expression of a block #10368

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 18, 2023

Conversation

c410-f3r
Copy link
Contributor

@c410-f3r c410-f3r commented Feb 18, 2023

For whatever reason, the return expression of a block is not contained inside the slice of statements and because of that the lint wasn't evaluating things that could potentially block the release of a lock.

pub fn example() -> i32 {
    let mutex = Mutex::new(1);
    let lock = mutex.lock().unwrap();
    let _ = *lock;
    let _ = *lock;
   do_heavy_computation_that_takes_time_and_returns_i32()
}

changelog: none

@rustbot
Copy link
Collaborator

rustbot commented Feb 18, 2023

r? @dswij

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

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Feb 18, 2023
@xFrednet
Copy link
Member

r? @xFrednet

@rustbot rustbot assigned xFrednet and unassigned dswij Feb 18, 2023
@xFrednet
Copy link
Member

Woops, yeah I missed this in the last review. Blocks are a bit tricky when it comes to this. Thank you, for finding that so quickly and creating a follow-up PR :)

@bors r+

@bors
Copy link
Contributor

bors commented Feb 18, 2023

📌 Commit 7518969 has been approved by xFrednet

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Feb 18, 2023

⌛ Testing commit 7518969 with merge 85d4b5a...

@bors
Copy link
Contributor

bors commented Feb 18, 2023

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: xFrednet
Pushing 85d4b5a to master...

@bors bors merged commit 85d4b5a into rust-lang:master Feb 18, 2023
@c410-f3r
Copy link
Contributor Author

Thanks @xFrednet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants