Fix rustc panic on second compile_input

Closes #19371
looks like this needs a licence