Al-Ilmam bi-Ahadith al-Ahkam 995
وَعَن أبي الدَّرْدَاء رَضِيَ اللَّهُ عَنْه أَن النَّبِي ﷺ أُتِي امْرَأَة مجحٍّ عَلَى بَاب فسطاط، فَقَالَ: " لَعَلَّه يُرِيد أَن يلم بهَا؟ " فَقَالُوا: نعم، فَقَالَ رَسُول الله ﷺ : " لقد هَمَمْت أَن ألعنه لعناً يدْخل مَعَه فِي قَبره، كَيفَ يورثه وَهُوَ لَا يحل لَهُ، كَيفَ يستخدمه وَهُوَ لَا يحل لَهُ! ". لفظ مُسلم .
And from Abu ad-Dardaʾ, may Allah be pleased with him: The Prophet ﷺ came upon a woman near to giving birth at the door of a tent. He said: "Perhaps he wants to have intercourse with her?" They said: Yes. The Messenger of Allah ﷺ said: "I was about to curse him with a curse that would enter his grave with him. How can he make him an heir when that is not lawful for him? How can he make him a servant when that is not lawful for him!" The wording of Muslim.