The Messenger of Allah ﷺ came in to see me one day and asked, "Do you have anything to eat?"I replied, "No."He said, "Then I am fasting."
حدثنا هناد حدثنا وكيع عن طلحة بن يحيى عن عمته عائشة بنت طلحة
دخل علي رسول الله ﷺ يوما فقال هل عندكم شيء قالت قلت لا قال فإني صائم
Muslim also recorded it in the Book of Fasting, chapter "The permissibility of fasting a voluntary fast with intention formed during the day before noon," etc., hadith no. 1154, from the hadith of Waki, with the same wording.