Swage the pipe and glue a new bit into it... If its ABS.
Or to practice and get it right, swage the new bit but it's better for the female end to be receiving the upstream male end
Thanks to all. After much contemplation in B&Q I finally bought a solvent weld coupler and 3m of 32mm pipe. Crazy that I had to buy 3m but only needed 35mm. Anyway, i stuck the coupler on the nubbin sticking out of the wall and bridged the gap to the compression on the u-bend with the 35mm pipe. FOR SALE: 2965mm x 32mm pipe.