  Rotation plays a key role in the star-formation process, from pre-stellar
cores to pre-main-sequence (PMS) objects. Understanding the formation of
massive stars requires taking into account the accretion of angular momentum
during their PMS phase. We study the PMS evolution of objects destined to
become massive stars by accretion, focusing on the links between the physical
conditions of the environment and the rotational properties of young stars. In
particular, we look at the physical conditions that allow the production of
massive stars by accretion. We present PMS models computed with a new version
of the Geneva Stellar Evolution code self-consistently including accretion and
rotation according to various accretion scenarios for mass and angular
momentum. We describe the internal distribution of angular momentum in PMS
stars accreting at high rates and we show how the various physical conditions
impact their internal structures, evolutionary tracks, and rotation velocities
during the PMS and the early main sequence. We find that the smooth angular
momentum accretion considered in previous studies leads to an angular momentum
barrier and does not allow the formation of massive stars by accretion. A
braking mechanism is needed in order to circumvent this angular momentum
barrier. This mechanism has to be efficient enough to remove more than 2/3 of
the angular momentum from the inner accretion disc. Due to the weak efficiency
of angular momentum transport by shear instability and meridional circulation
during the accretion phase, the internal rotation profiles of accreting stars
reflect essentially the angular momentum accretion history. As a consequence,
careful choice of the angular momentum accretion history allows circumvention
of any limitation in mass and velocity, and production of stars of any mass and
velocity compatible with structure equations.
