Fix rustc panic on second compile_input

Closes #19371