# Arc::increment\_strong\_count design question

**URL:** <https://internals.rust-lang.org/t/arc-increment-strong-count-design-question/24177>\
**Category:** libs\
**Created:** [April 15, 2026, 12:29pm UTC](https://internals.rust-lang.org/t/arc-increment-strong-count-design-question/24177 "2026-04-15T12:29:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![akrauze](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/akrauze/32/12586_2.png) [@akrauze](https://internals.rust-lang.org/u/akrauze)\
**Post date:** [April 15, 2026, 12:29pm UTC](https://internals.rust-lang.org/t/arc-increment-strong-count-design-question/24177/1 "2026-04-15T12:29:37Z")

</div>

I was reading docs of [`Arc::increment_strong_count`](https://doc.rust-lang.org/stable/std/sync/struct.Arc.html#method.increment_strong_count) and in the safety section I found requirement that raw pointer passed to the function must point to valid allocation created by _global allocator_.

> The pointer must have been obtained through `Arc::into_raw` and must satisfy the same layout requirements specified in [`Arc::from_raw_in`](https://doc.rust-lang.org/stable/std/sync/struct.Arc.html#method.from_raw_in). The associated `Arc` instance must be valid (i.e. the strong count must be at least 1) for the duration of this method, and `ptr` must point to a block of memory allocated by the global allocator.

This requirement surprised me, so I looked into implementation and after going though `Arc::increment_strong_count_in` layer I found that the implementation basically just creates `Arc` from raw pointer and clones it:

```rust
// Retain Arc, but don't touch refcount by wrapping in ManuallyDrop
let arc = unsafe { mem::ManuallyDrop::new(Arc::from_raw_in(ptr, alloc)) };
// Now increase refcount, but don't drop new refcount either
let _arc_clone: mem::ManuallyDrop<_> = arc.clone();

```

Why does the implementation of `Arc::increment_strong_count` simply not walk pointers and increment strong count directly? Requiring `alloc` to be passed into `Arc::increment_strong_count` seams overly constraining, since at no point the allocator is used at all.

I understand why [`Arc::decrement_strong_count`](https://doc.rust-lang.org/stable/std/sync/struct.Arc.html#method.decrement_strong_count) needs access to the allocator, as it needs to drop inner `T` and `ArcInner` when strong and weak counters go to 0. Was `Arc::increment_strong_count` designed in such way to keep symmetry with decrementing part? Or is there some safety invariant that I do not see, that would be violated if `Arc::increment_strong_count` would call `fetch_add` on the strong counter directly?

---

<div class="post-metadata">

**Author:** ![akrauze](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/akrauze/32/12586_2.png) [@akrauze](https://internals.rust-lang.org/u/akrauze)\
**Post date:** [April 22, 2026, 11:28am UTC](https://internals.rust-lang.org/t/arc-increment-strong-count-design-question/24177/2 "2026-04-22T11:28:00Z")

</div>

I created a [cross-post](https://users.rust-lang.org/t/arc-increment-strong-count-design-question-cross-post/139708) in the users forum, since nothing happened here for a week.

---

<div class="post-metadata">

**Author:** ![kornel](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/kornel/32/2711_2.png) [@kornel](https://internals.rust-lang.org/u/kornel)\
**Post date:** [April 22, 2026, 11:46am UTC](https://internals.rust-lang.org/t/arc-increment-strong-count-design-question/24177/3 "2026-04-22T11:46:28Z")

</div>

I think it's just implementation leaking into the API.

Instead of changing the counter directly, it reuses existing implementation via `Arc::from_raw_in().clone()`. This requires having a real instance of the `Arc`, which requires providing an allocator.
