Add rustc_diagnostic_item to sys::Mutex methods#141690
Merged
bors merged 3 commits intorust-lang:masterfrom May 29, 2025
Merged
Add rustc_diagnostic_item to sys::Mutex methods#141690bors merged 3 commits intorust-lang:masterfrom
rustc_diagnostic_item to sys::Mutex methods#141690bors merged 3 commits intorust-lang:masterfrom
Conversation
Member
Member
|
Please add a comment above each attribute explaining that it is for Miri's concurrency model checker. r=me with those comments added. |
tgross35
reviewed
May 28, 2025
|
|
||
| pub struct Mutex { | ||
| pub pal: OnceBox<pal::Mutex>, | ||
| pub(in crate::sys::sync) pal: OnceBox<pal::Mutex>, |
Contributor
There was a problem hiding this comment.
Is this needed for Miri or just a pedantic change? Makes sense in either case.
Contributor
Author
There was a problem hiding this comment.
Just a pedantic change.
Member
There was a problem hiding this comment.
To give more context -- the model checking for mutexes would become weird or even unsound if the mutex API is bypassed by directly accessing the underlying mutex operations, so we wanted to reduce the risk of that happening.
Contributor
Author
|
I've added the comments. r? @m-ou-se |
Collaborator
|
Requested reviewer is already assigned to this pull request. Please choose another assignee. |
Member
|
@bors r+ rollup |
Collaborator
tgross35
added a commit
to tgross35/rust
that referenced
this pull request
May 28, 2025
Add `rustc_diagnostic_item` to `sys::Mutex` methods For an ongoing project for adding a concurrency model checker to Miri we need to be able to intercept locking/unlocking operations on standard library mutexes. This PR adds diagnostic items to the relevant calls `lock`, `try_lock` and `unlock` for the `sys::Mutex` implementation on the targets we care about. This PR also makes the internals of `pthread::Mutex` less public, to reduce the chance of anyone locking/unlocking a mutex without going through the intercepted methods. r? `@RalfJung`
bors
added a commit
that referenced
this pull request
May 28, 2025
Rollup of 8 pull requests Successful merges: - #125087 (Optimize `Seek::stream_len` impl for `File`) - #138285 (Stabilize `repr128`) - #139994 (add `CStr::display`) - #141477 (Path::with_extension: show that it adds an extension where one did no…) - #141533 (clean up old rintf leftovers) - #141690 (Add `rustc_diagnostic_item` to `sys::Mutex` methods) - #141693 (Subtree update of `rust-analyzer`) - #141702 (Add eholk to compiler reviewer rotation) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
that referenced
this pull request
May 29, 2025
Rollup of 16 pull requests Successful merges: - #136429 (GCI: At their def site, actually wfcheck the where-clause & always eval free lifetime-generic constants) - #138139 (Emit warning while outputs is not exe and prints linkage info) - #141104 (Test(fs): Fix `test_eq_windows_file_type` for Windows 7) - #141477 (Path::with_extension: show that it adds an extension where one did no…) - #141533 (clean up old rintf leftovers) - #141612 (Call out possibility of invariant result in variance markers) - #141638 (Use `builtin_index` instead of hand-rolling it) - #141643 (ci: verify that codebuild jobs use ghcr.io) - #141675 (Reorder `ast::ItemKind::{Struct,Enum,Union}` fields.) - #141680 (replace TraitRef link memory.md) - #141682 (interpret/allocation: Fixup type for `alloc_bytes`) - #141683 (Handle ed2021 precise capturing of unsafe binder) - #141684 (rustbook: Bump versions of `onig` and `onig_sys`) - #141687 (core: unstably expose atomic_compare_exchange so stdarch can use it) - #141690 (Add `rustc_diagnostic_item` to `sys::Mutex` methods) - #141702 (Add eholk to compiler reviewer rotation) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
that referenced
this pull request
May 29, 2025
Rollup merge of #141690 - Patrick-6:intercept-mutex, r=m-ou-se Add `rustc_diagnostic_item` to `sys::Mutex` methods For an ongoing project for adding a concurrency model checker to Miri we need to be able to intercept locking/unlocking operations on standard library mutexes. This PR adds diagnostic items to the relevant calls `lock`, `try_lock` and `unlock` for the `sys::Mutex` implementation on the targets we care about. This PR also makes the internals of `pthread::Mutex` less public, to reduce the chance of anyone locking/unlocking a mutex without going through the intercepted methods. r? ``@RalfJung``
github-actions bot
pushed a commit
to model-checking/verify-rust-std
that referenced
this pull request
May 30, 2025
Add `rustc_diagnostic_item` to `sys::Mutex` methods For an ongoing project for adding a concurrency model checker to Miri we need to be able to intercept locking/unlocking operations on standard library mutexes. This PR adds diagnostic items to the relevant calls `lock`, `try_lock` and `unlock` for the `sys::Mutex` implementation on the targets we care about. This PR also makes the internals of `pthread::Mutex` less public, to reduce the chance of anyone locking/unlocking a mutex without going through the intercepted methods. r? ``@RalfJung``
github-actions bot
pushed a commit
to rust-lang/rustc-dev-guide
that referenced
this pull request
Jun 2, 2025
Rollup of 16 pull requests Successful merges: - rust-lang/rust#136429 (GCI: At their def site, actually wfcheck the where-clause & always eval free lifetime-generic constants) - rust-lang/rust#138139 (Emit warning while outputs is not exe and prints linkage info) - rust-lang/rust#141104 (Test(fs): Fix `test_eq_windows_file_type` for Windows 7) - rust-lang/rust#141477 (Path::with_extension: show that it adds an extension where one did no…) - rust-lang/rust#141533 (clean up old rintf leftovers) - rust-lang/rust#141612 (Call out possibility of invariant result in variance markers) - rust-lang/rust#141638 (Use `builtin_index` instead of hand-rolling it) - rust-lang/rust#141643 (ci: verify that codebuild jobs use ghcr.io) - rust-lang/rust#141675 (Reorder `ast::ItemKind::{Struct,Enum,Union}` fields.) - rust-lang/rust#141680 (replace TraitRef link memory.md) - rust-lang/rust#141682 (interpret/allocation: Fixup type for `alloc_bytes`) - rust-lang/rust#141683 (Handle ed2021 precise capturing of unsafe binder) - rust-lang/rust#141684 (rustbook: Bump versions of `onig` and `onig_sys`) - rust-lang/rust#141687 (core: unstably expose atomic_compare_exchange so stdarch can use it) - rust-lang/rust#141690 (Add `rustc_diagnostic_item` to `sys::Mutex` methods) - rust-lang/rust#141702 (Add eholk to compiler reviewer rotation) r? `@ghost` `@rustbot` modify labels: rollup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For an ongoing project for adding a concurrency model checker to Miri we need to be able to intercept locking/unlocking operations on standard library mutexes.
This PR adds diagnostic items to the relevant calls
lock,try_lockandunlockfor thesys::Muteximplementation on the targets we care about.This PR also makes the internals of
pthread::Mutexless public, to reduce the chance of anyone locking/unlocking a mutex without going through the intercepted methods.r? @RalfJung