mirror of https://github.com/astral-sh/ruff
[red-knot] Don't panic when `primary-span` is missing while panicking (#17799)
This commit is contained in:
parent
675a5af89a
commit
f7cae4ffb5
|
|
@ -468,6 +468,11 @@ impl Drop for DiagnosticGuard<'_, '_> {
|
|||
// once.
|
||||
let diag = self.diag.take().unwrap();
|
||||
|
||||
if std::thread::panicking() {
|
||||
// Don't submit diagnostics when panicking because they might be incomplete.
|
||||
return;
|
||||
}
|
||||
|
||||
let Some(ann) = diag.primary_annotation() else {
|
||||
panic!(
|
||||
"All diagnostics reported by `InferContext` must have a \
|
||||
|
|
|
|||
Loading…
Reference in New Issue