Is UnsafeCell a special magical type known to compiler?

73 points SolidMarsupial

Basically, as title says: is UnsafeCell a special type known to compiler or can one implement something similar and get the same functionality on top of it (Cell/RefCell)?

This is basically out of curiosity, I am not planning to reimplement things that are provided (well, maybe only for educational purposes).