Once https://github.com/rust-lang/rust/issues/54140 closes and gets added in stable Rust, add better diagnostic handling.