It's a matter of aim. If a spacecraft is on a course near the sun it will whip past like a comet. It might melt or be vaporized by the sun's heat and some material blown free by the solar wind, as occurs with comets. If the trajectory crosses the sun's surface though, the molten remains would slam into the sun at high
velocity, just like the early moon probes.