Closed as not planned
Description
opened on May 2, 2015
Currently UnsafeCell
does not implement Copy
. It would be beneficial if it could, for at least two reasons:
- Easier initialization of fixed arrays, e g:
[UnsafeCell::new(0i32); 75]
- It enables people to make cell-like types which are
Copy
.
AFAIK, there are no disadvantages for UnsafeCell
to implement Copy
.
Note: the reason people can't just copy-and-paste the code for UnsafeCell
to make their own variant with copy semantics, is that UnsafeCell
is a #[lang="unsafe_cell"]
: "The UnsafeCell<T>
type is the only legal way to obtain aliasable data that is considered mutable. In general, transmuting an &T
type into an &mut T
is considered undefined behavior."
Activity