The principle of International Law, which under certain circumstances provide diplomatic immunity, cannot be applied to acts which are condemned as criminal by International Law (source):
The IMT was established for the punishment of the major war criminals of the European Axis, i.e. for the trial and punishment of German high officials who perpetrated aggression, war crimes, and crimes against humanity “in connection” with the Second World War. At the end of the trial, the IMT issued one of the most important judgments in the history of international law. On the question of immunity, the position of the IMT consisted of the following:
The principle of International Law, which under certain circumstances protects the representatives of a State, cannot be applied to acts which are condemned as criminal by International Law. The authors of these acts cannot shelter themselves behind their official position in order to be freed from punishment in appropriate proceedings […]. On the other hand […] he who violates the laws of war cannot obtain immunity while acting in pursuance of the authority of the State if the State in authorizing action moves outside its competence under International Law (emphasis added).
Another answer says some such diplomats were not arrested, this still may not mean that if arrested, they could present this as a violation of international law. There were protest activities during these visits. It was especially tough for al-Bashir in South Africa where courts and local activists intervened, and the whole situation was quite tense (source).
Surely, professional diplomats avoiding confrontation, leave alone the nuclear strike as Dmitry Medvedev now threatens, may first tell in a very polite and subtle way the head of state under warrant that maybe could defer the visit, "it is too rainy now". If this would not work, it would probably be less confrontation by declaring him persona non grata. The head of state will miss some meetings and events that may be important.