كتاب الفتن وأشراط الساعة
54  
The Book of Tribulations and Portents of the Last Hour
(18)
Chapter: The Hour Will Not Begin Until A Man Passes By Another Man's Grave And Wishes That He Was In The Place Of The Deceased, Because Of Calamity
(18)
بَاب لَا تَقُومُ السَّاعَةُ حَتَّى يَمُرَّ الرَّجُلُ بِقَبْرِ الرَّجُلِ فَيَتَمَنَّى أَنْ يَكُونَ مَكَانَ الْمَيِّتِ مِنْ الْبَلَاءِ
Sahih Muslim 157 L

Abu Huraira reported Allah's Messenger (ﷺ) as saying:

By Him, in Whose hand is my life, the world would not come to an end until a person would pass by a grave, would roll over it and express the desire that he should be in the place of the occupant of that grave not because of religious reasons but because of this calamity.
حَدَّثَنَا عَبْدُ اللَّهِ بْنُ عُمَرَ بْنِ مُحَمَّدِ بْنِ أَبَانَ بْنِ صَالِحٍ، وَمُحَمَّدُ بْنُ يَزِيدَ الرِّفَاعِيُّ، - وَاللَّفْظُ لاِبْنِ أَبَانَ - قَالاَ حَدَّثَنَا ابْنُ فُضَيْلٍ، عَنْ أَبِي إِسْمَاعِيلَ، عَنْ أَبِي حَازِمٍ، عَنْ أَبِي، هُرَيْرَةَ قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏ "‏ وَالَّذِي نَفْسِي بِيَدِهِ لاَ تَذْهَبُ الدُّنْيَا حَتَّى يَمُرَّ الرَّجُلُ عَلَى الْقَبْرِ فَيَتَمَرَّغُ عَلَيْهِ وَيَقُولُ يَا لَيْتَنِي كُنْتُ مَكَانَ صَاحِبِ هَذَا الْقَبْرِ وَلَيْسَ بِهِ الدِّينُ إِلاَّ الْبَلاَءُ ‏"‏ ‏.‏
Reference : Sahih Muslim 157L
In-book reference : Book 54, Hadith 68
USC-MSA web (English) reference : Book 41, Hadith 6948
  (deprecated numbering scheme)