Probing neutron-star matter in the lab: connecting binary mergers to heavy-ion collisions