-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Use a single static for all default slice Arcs. #125283
Conversation
Also adds debug_asserts in Drop for Weak/Arc that the shared static is not being "dropped"/"deallocated".
This comment has been minimized.
This comment has been minimized.
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.
Thank you!
Adding the debug asserts in Drop is a wonderful idea.
struct SliceArcInnerForStatic { | ||
inner: ArcInner<[u8; 1]>, | ||
} | ||
const MAX_STATIC_INNER_SLICE_ALIGNMENT: usize = 16; |
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.
This needs a #[cfg(not(no_global_oom_handling))]
, since the Default
impls using this only exist in that configuration.
Optionally we can put #[cfg(not(no_global_oom_handling))]
on STATIC_INNER_SLICE too, and the debug-asserts in Drop, but it doesn't really hurt without.
@bors r+ |
Use a single static for all default slice Arcs. Also adds debug_asserts in Drop for Weak/Arc that the shared static is not being "dropped"/"deallocated". As per rust-lang#124640 (review) r? dtolnay
Use a single static for all default slice Arcs. Also adds debug_asserts in Drop for Weak/Arc that the shared static is not being "dropped"/"deallocated". As per rust-lang#124640 (review) r? dtolnay
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#125219 (Update `unexpected_cfgs` lint for Cargo new `check-cfg` config) - rust-lang#125255 (Make `EvalCtxt` generic over `InferCtxtLike`) - rust-lang#125283 (Use a single static for all default slice Arcs.) - rust-lang#125300 (rustdoc: Don't strip items with inherited visibility in `AliasedNonLocalStripper`) - rust-lang#125309 (Fix `tests/debuginfo/strings-and-strs`.) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 4 pull requests Successful merges: - rust-lang#125255 (Make `EvalCtxt` generic over `InferCtxtLike`) - rust-lang#125283 (Use a single static for all default slice Arcs.) - rust-lang#125300 (rustdoc: Don't strip items with inherited visibility in `AliasedNonLocalStripper`) - rust-lang#125309 (Fix `tests/debuginfo/strings-and-strs`.) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#125283 - zachs18:arc-default-shared, r=dtolnay Use a single static for all default slice Arcs. Also adds debug_asserts in Drop for Weak/Arc that the shared static is not being "dropped"/"deallocated". As per rust-lang#124640 (review) r? dtolnay
Also adds debug_asserts in Drop for Weak/Arc that the shared static is not being "dropped"/"deallocated".
As per #124640 (review)
r? dtolnay