Closed arielb1 closed 8 years ago
However, if any such execution contains an undefined operation, this International Standard places no requirement on the implementation executing that program with that input (not even with regard to operations preceding the first undefined operation).
The important thing is "if any such execution contains an undefined operation". No execution of the code given contains an undefined operation.
Code example:
This must call
abort_if
before theunchecked_get_mut
- i.e. ifabort_if
has the obvious implementation, this code must never be UB.This seems obvious to me, but according to some people, doing the write first is Perfectly Legal because of UB.