Sahih Muslim , Hadith 1145

Salama b. Akwa' (Allah be pleased with him) reported that when this verse was revealed: "And as for those who can fast (but do not) expiation is the feeding of a needy person" (ii. 183), (he who liked to observe fast did observe it) and he who felt reluctant to observe it ate and expiated till the verse was revealed which abrogated it.

حَدَّثَنَا قُتَيْبَةُ بْنُ سَعِيدٍ، حَدَّثَنَا بَكْرٌ، - يَعْنِي ابْنَ مُضَرَ - عَنْ عَمْرِو بْنِ الْحَارِثِ، عَنْ بُكَيْرٍ، عَنْ يَزِيدَ، مَوْلَى سَلَمَةَ عَنْ سَلَمَةَ بْنِ الأَكْوَعِ، - رضى الله عنه - قَالَ لَمَّا نَزَلَتْ هَذِهِ الآيَةُ ‏{‏ وَعَلَى الَّذِينَ يُطِيقُونَهُ فِدْيَةٌ طَعَامُ مِسْكِينٍ‏}‏ كَانَ مَنْ أَرَادَ أَنْ يُفْطِرَ وَيَفْتَدِيَ ‏.‏ حَتَّى نَزَلَتِ الآيَةُ الَّتِي بَعْدَهَا فَنَسَخَتْهَا ‏.‏

sunnah.com

Salama b. Akwa' reported: We, during the lifetime of the Messenger of Allah, in one month of Ramadan (observed fast according to our liking). He who wished to fast lasted and he who wished to break broke it and fed a needy person as an expiation 1544 till this verse was revealed:" He who witnesses among you the month (of Ramadan) he should observe fast during it" (ii. 184).

حَدَّثَنِي عَمْرُو بْنُ سَوَّادٍ الْعَامِرِيُّ، أَخْبَرَنَا عَبْدُ اللَّهِ بْنُ وَهْبٍ، أَخْبَرَنَا عَمْرُو بْنُ، الْحَارِثِ عَنْ بُكَيْرِ بْنِ الأَشَجِّ، عَنْ يَزِيدَ، مَوْلَى سَلَمَةَ بْنِ الأَكْوَعِ عَنْ سَلَمَةَ بْنِ الأَكْوَعِ، - رضى الله عنه - أَنَّهُ قَالَ كُنَّا فِي رَمَضَانَ عَلَى عَهْدِ رَسُولِ اللَّهِ صلى الله عليه وسلم مَنْ شَاءَ صَامَ وَمَنْ شَاءَ أَفْطَرَ فَافْتَدَى بِطَعَامِ مِسْكِينٍ حَتَّى أُنْزِلَتْ هَذِهِ الآيَةُ ‏{‏ فَمَنْ شَهِدَ مِنْكُمُ الشَّهْرَ فَلْيَصُمْهُ‏}‏

sunnah.com