"They (the Companions) said: 'O Messenger of Allah, how do you hold those who died while they were drinking Khamr - considering that the prohibition of intoxicants is now revealed?' So, (the following) Ayah was revealed: "Those who believe and do righteous good deeds, there is no sin on them for what they ate (in the past), if they fear Allah and believe and do righteous good deeds." (Using translation from Tirmidhī 3052)
لَمَّا نَزَلَ تَحْرِيمُ الْخَمْرِ قَالُوا يَا رَسُولَ اللهِالَّذِينَ مَاتُوا وَهُمْ يَشْرَبُونَ الْخَمْرَ؟ فَنَزَلَتْ {لَيْسَ عَلَى الَّذِينَ آمَنُوا وَعَمِلُوا الصَّالِحَاتِ جُنَاحٌ فِيمَا طَعِمُوا} [المائدة 93] إِلَى آخِرِ الْآيَةِ