Jami` at-Tirmidhi Book 10, Hadith 20
The Prophet said: "Beware of An-Na'i, for indeed announcing one's death is from the deeds of Jahliyyah."
The Prophet entered upon a young man while he was dying. So he said: "How do you feel?" He said: "By Allah! O Messenger of Allah! Indeed I hope in Allah and I fear from my sins." So the Messenger of Allah said: "These two will not be gathered in a worshipper's heart at a time such as this, except that Allah will grant him what he hopes and make him safe from what he fears."
(from the Prophet) similar (to no. 984), but he did not narrate it in Marfu form, and he did not mention in it: "An-Na'i is announcing of one's death."