Sahih Bukhari Volume 003, Book 031, Hadith Number 167.

Narated By Jabir bin 'Abdullah : Allah's Apostle was on a journey and saw a crowd of people, and a man was being shaded (by them). He asked, "What is the matter?" They said, "He (the man) is fasting." The Prophet said, "It is not righteousness that you fast on a journey."