When rigor mortis sets in will a man have an erection?

No. This is a perennial folktale. It just doesn't happen. A tiny amount of semen may be expressed if a man has quite a bit on board as the nearby muscles stiffen.