-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
clarify Arc::clone overflow check comment #98364
Conversation
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
(rust-highfive has picked a reviewer for you, use r? to override) |
library/alloc/src/sync.rs
Outdated
// any realistic program. | ||
// | ||
// This check is not 100% water-proof: we error when the refcount grows beyond `isize::MAX` | ||
// on the assumption that there aren't ~2 billion threads incrementing the reference count |
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.
Maybe worth noting where the 2 billion comes from? On a 16-bit platform for example this is much more of a problem (not that we support those today, I think?).
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.
So no test that triggers this logic on 64 bit pointer systems ? :)
This logic Is more a bout detecting corrupted memory.
Could this functionality be configurable ?. So can get smaller code size, and 1 less branch.
r=me with or without nit fixed |
I did some more rewording to avoid the issue you pointed out; please take another look. |
@bors r+ rollup |
📌 Commit 46b2454 has been approved by |
clarify Arc::clone overflow check comment I had to read this twice to realize that this is explaining that the code is technically unsound, so move that into a dedicated paragraph and make the wording a bit more explicit.
clarify Arc::clone overflow check comment I had to read this twice to realize that this is explaining that the code is technically unsound, so move that into a dedicated paragraph and make the wording a bit more explicit.
…piler-errors Rollup of 16 pull requests Successful merges: - rust-lang#96173 (Fix documentation for `with_capacity` and `reserve` families of methods) - rust-lang#98184 (Give name if anonymous region appears in impl signature) - rust-lang#98259 (Greatly improve error reporting for futures and generators in `note_obligation_cause_code`) - rust-lang#98269 (Provide a `PathSegment.res` in more cases) - rust-lang#98283 (Point at private fields in struct literal) - rust-lang#98305 (prohibit_generics: don't alloc error string if no error emitted) - rust-lang#98310 (rustdoc: optimize loading of source sidebar) - rust-lang#98353 (Migrate two diagnostics from the `rustc_builtin_macros` crate) - rust-lang#98355 (Update no_default_libraries handling for emscripten target) - rust-lang#98364 (clarify Arc::clone overflow check comment) - rust-lang#98365 (Address review comments from rust-lang#98259) - rust-lang#98388 (implement `iter_projections` function on `PlaceRef`) - rust-lang#98390 (Fixes handling of keywords in rustdoc json output) - rust-lang#98409 (triagebot.toml: Allow applying nominated labels) - rust-lang#98410 (Update books) - rust-lang#98422 (Update browser-ui-test version to 0.9.6) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
I had to read this twice to realize that this is explaining that the code is technically unsound, so move that into a dedicated paragraph and make the wording a bit more explicit.