It's interesting that the intent discussed there doesn't match rustc's current behavior, which avoids niche optimization for UnsafeCell
and RefCell
, but still does it for Cell
, RwLock
, and Mutex
.
Though I suppose for RwLock
/Mutex
it might be niching a different part of the structure, e.g. the Box
for the system impl. So that could match the discussed plan + reënabling niching for Cell
.