A rock cake, also called a rock bun, is a small, hard fruit cake with a rough surface resembling a rock (Wikipedia).
(image from http://ozladym.com/recipes/RockCakes.htm)
Hagrid is fond of baking and serving rock cakes. His rock cakes are particularly hard, living up to the name: "The rock cakes were shapeless lumps with raisins that almost broke their teeth, but Harry and Ron pretended to be enjoying them as they told Hagrid all about their first lessons." (PS8)
A rock cake was an item which could be collected in Pottermore (Pm).