The exact behavior on locking a mutex in the thread which already holds the lock is left unspecified. However, this function will not return on the second call (it might panic or deadlock, for example).
You can, however, detect this at runtime by using try_lock, which returns a WouldBlock error if the lock is already held somewhere else. If that 'somewhere' is on the same thread, locking would cause a deadlock.