Skip to content
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

Consider dropping Freeze from the MutexArc bounds #12142

Closed
alexcrichton opened this issue Feb 9, 2014 · 3 comments
Closed

Consider dropping Freeze from the MutexArc bounds #12142

alexcrichton opened this issue Feb 9, 2014 · 3 comments

Comments

@alexcrichton
Copy link
Member

I see this was added as part of #7473, but I don't understand why MutexArc needs a Freeze bound for access and access_cond. I was under the impression that Freeze was just needed for safely sharing read-only data among threads, but a MutexArc only hands out one &mut T at a time, so I don't think this should be necessary.

@thestinger
Copy link
Contributor

I think it was intended to prevent locking the same lock twice. I don't think consistent behaviour (one of deadlocking, recursive locking or reporting an error) can be provided when lock elision or hardware transactional memory is used as it may simply succeed due to lack of a conflict during the lock scope.

@alexcrichton
Copy link
Member Author

Ah indeed, the recursive lock was the reason it was added.

@thestinger
Copy link
Contributor

I don't think we'll be able to prevent recursive locking if we switch to RAII locks anyway, so we may still want to remove the bounds. It's just going to be sad to lack lock elision as it becomes more and more important. I guess we could make a separate lock type...

bors added a commit to rust-lang-ci/rust that referenced this issue Jul 25, 2022
… r=lnicola

feat: Sort items by trait definition assist

This PR replaces the "Sort **methods** by trait definition" assist with a "Sort **items** by trait definition" assist that sorts all items, not just methods.

![sort-items-by-trait-def-showcase](https://user-images.githubusercontent.com/38225716/166491828-0bc10dbd-91be-408f-9fe0-636ef5e99377.gif)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants