We investigate the impact of stellar rotation on the formation of black holes (BHs), by means of our population-synthesis code SEVN. Rotation affects the mass function of BHs in several ways. In massive metal-poor stars, fast rotation reduces the minimum zero-age main sequence (ZAMS) mass for a star to undergo pair instability and pulsational pair instability. Moreover, stellar winds are enhanced by rotation, peeling-off the entire hydrogen envelope. As a consequence of these two effects, the maximum BH mass we expect from the collapse a rotating metal-poor star is only $sim{}45$ M$_odot$, while the maximum mass of a BH born from a non-rotating star is $sim{}60$ M$_odot$. Furthermore, stellar rotation reduces the minimum ZAMS mass for a star to collapse into a BH from $sim{}18-25$ M$_odot$ to $sim{}13-18$ M$_odot$. Finally, we have investigated the impact of different core-collapse supernova (CCSN) prescriptions on our results. While the threshold value of compactness for direct collapse and the fallback efficiency strongly affect the minimum ZAMS mass for a star to collapse into a BH, the fraction of hydrogen envelope that can be accreted onto the final BH is the most important ingredient to determine the maximum BH mass. Our results confirm that the interplay between stellar rotation, CCSNe and pair instability plays a major role in shaping the BH mass spectrum.