  An edge-coloured graph is said to be rainbow if no colour appears more than
once. Extremal problems involving rainbow objects have been a focus of much
research over the last decade as they capture the essence of a number of
interesting problems in a variety of areas. A particularly intensively studied
question due to Keevash, Mubayi, Sudakov and Verstra\"ete from 2007 asks for
the maximum possible average degree of a properly edge-coloured graph on $n$
vertices without a rainbow cycle. Improving upon a series of earlier bounds,
Tomon proved an upper bound of $(\log n)^{2+o(1)}$ for this question. Very
recently, Janzer-Sudakov and Kim-Lee-Liu-Tran independently removed the $o(1)$
term in Tomon's bound, showing a bound of $O(\log^2 n)$. We prove an upper
bound of $(\log n)^{1+o(1)}$ for this maximum possible average degree when
there is no rainbow cycle. Our result is tight up to the $o(1)$ term, and so it
essentially resolves this question. In addition, we observe a connection
between this problem and several questions in additive number theory, allowing
us to extend existing results on these questions for abelian groups to the case
of non-abelian groups.
