I am not an expert but I think the actual problem is in the slice::iter first getting an immutable reference to the underlying data with self.0.next() before mapping it into a UserRef<T> which is instant UB because a &T guarantees exclusivity while UserRef<T> explicitly states in its contract that it does not guarantee anything like that, even if mutably borrowed.
So in essence the problem, as I understood it, is in the step from slice -> reference to value -> User ref of value with the italic part being illegal.
I am not an expert but I think the actual problem is in the slice::iter first getting an immutable reference to the underlying data with
self.0.next()before mapping it into aUserRef<T>which is instant UB because a&Tguarantees exclusivity whileUserRef<T>explicitly states in its contract that it does not guarantee anything like that, even if mutably borrowed.So in essence the problem, as I understood it, is in the step from slice -> reference to value -> User ref of value with the italic part being illegal.