Can &Cell footprints grow?

⚓ Rust    📅 2026-05-29    👤 surdeus    👁️ 3      

surdeus

Info

This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Can &Cell footprints grow?

Hey all,

I am wondering if it is possible for the footprint of a &Cell<T> to grow such that it encompasses other simultaneously live Cells.

For example, let's say you have two shared references to Cells, one is of type &Cell<[i32]> and the other is of type &Cell<[i32; N]>. Let's also assume that both Cells point into the same original allocation, but the second cell points to the last N bytes and the length of the first slice is the <size of the original allocation> - N.
Would it be sound to modify the length of the slice pointed to by the first cell so that it encompasses the target of the second Cell?

I guess I have the same question generally of any instance of &UnsafeCell<T>.

5 posts - 3 participants

Read full topic

🏷️ Rust_feed