When the prohibition of wine was revealed, the companions said, "Messenger of Allah, what about those who died while they were still drinking wine?"Then the verse was revealed, "There is no blame upon those who believe and do righteous deeds for what they have consumed" [Maidah 5:93], to the end of the verse.
حدثنا خلف بن الوليد حدثنا إسرائيل عن سماك عن عكرمة
لما نزل تحريم الخمر قالوا يا رسول الله الذين ماتوا وهم يشربون الخمر فنزلت {ليس على الذين آمنوا وعملوا الصالحات جناح فيما طعموا} إلى آخر الآية