-
Notifications
You must be signed in to change notification settings - Fork 109
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
Avoid unnecessary synchronization in {force,deref}_mut
#231
Avoid unnecessary synchronization in {force,deref}_mut
#231
Conversation
- `DerefMut` was not delegating to `force_mut()` (contary to the by-ref APIs); - `Lazy::force_mut` was not taking advantage of exclusive-mutability access, and instead paying shared-mutability access. Mainly, in the `sync` case, it involved atomic operations which are now skipped. Fixes matklad#226
}; | ||
this.cell = OnceCell::with_value(value); | ||
} | ||
this.cell.get_mut().unwrap_or_else(|| unreachable!()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Trying to rewrite this so as to avoiding the double-get_mut()
on the happy path runs into polonius
)
Could you bump a patch version in Cargo.toml and add a short note to the Changelog? |
bors d+ |
✌️ danielhenrymantilla can now approve this pull request. To approve and merge a pull request, simply reply with |
@matklad I won't approve the PR myself since I have also taken the liberty to add a
|
if let err @ Err(_) = cmd!(sh, "cargo update -w -v --locked").run() { | ||
// `Cargo.lock.msrv` is out of date! Probably from having bumped our own version number. | ||
println! {"\ | ||
Error: `Cargo.lock.msrv` is out of date. \ | ||
Please run:\n \ | ||
(cp Cargo.lock{{.msrv,}} && cargo +{MSRV} update -w -v && cp Cargo.lock{{.msrv,}})\n\ | ||
\n\ | ||
Alternatively, `git apply` the `.patch` below:\ | ||
"} | ||
cmd!(sh, "cargo update -q -w").quiet().run()?; | ||
sh.copy_file("Cargo.lock", "Cargo.lock.msrv")?; | ||
cmd!(sh, "git --no-pager diff --color=always -- Cargo.lock.msrv").quiet().run()?; | ||
return err; | ||
} | ||
cmd!(sh, "cargo build --locked").run()?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bors r+ |
Build succeeded! The publicly hosted instance of bors-ng is deprecated and will go away soon. If you want to self-host your own instance, instructions are here. If you want to switch to GitHub's built-in merge queue, visit their help page. |
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [once_cell](https://github.com/matklad/once_cell) | dependencies | minor | `1.17.1` -> `1.18.0` | --- ### Release Notes <details> <summary>matklad/once_cell</summary> ### [`v1.18.0`](https://github.com/matklad/once_cell/blob/HEAD/CHANGELOG.md#​1180) [Compare Source](matklad/once_cell@v1.17.2...v1.18.0) - `MSRV` is updated to 1.60.0 to take advantage of `dep:` syntax for cargo features, removing "implementation details" from publicly visible surface. ### [`v1.17.2`](https://github.com/matklad/once_cell/blob/HEAD/CHANGELOG.md#​1172) [Compare Source](matklad/once_cell@v1.17.1...v1.17.2) - Avoid unnecessary synchronization in `Lazy::{force,deref}_mut()`, [#​231](matklad/once_cell#231). </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xMTUuMiIsInVwZGF0ZWRJblZlciI6IjM1LjExNS4yIiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCJ9--> Co-authored-by: cabr2-bot <[email protected]> Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1932 Reviewed-by: crapStone <[email protected]> Co-authored-by: Calciumdibromid Bot <[email protected]> Co-committed-by: Calciumdibromid Bot <[email protected]>
DerefMut
was not delegating toforce_mut()
(contary to the by-ref APIs);Lazy::force_mut
was not taking advantage of exclusive-mutability access, and instead paying shared-mutability access. Mainly, in thesync
case, it involved atomic operations which are now skipped.Fixes #226