Phase separation in carbon-doped MgB2 superconductors