When the Messenger of Allah ﷺ was in a state of major ritual impurity and wished to sleep, he would perform ablution.Ubayy said, Waki and Muhammad bin Jafar reported in this hadith, "When he wished to sleep or eat, he would perform ablution."Yahya said that Shuba abandoned Hakam's hadith concerning the one in a state of major ritual impurity performing ablution when he wished to eat.
حدثنا يحيى عن شعبة قال حدثنا الحكم عن إبراهيم عن الأسود
كان رسول الله ﷺ إذا كان جنبا فأراد أن ينام توضأ قال أبي وقال وكيع ومحمد بن جعفر في هذا الحديث إذا أراد أن ينام أو يأكل توضأ قال يحيى ترك شعبة حديث الحكم في الجنب إذا أراد أن يأكل توضأ