mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-26 11:59:10 +00:00
[red-knot] Don't panic when primary-span
is missing while panicking (#17799)
This commit is contained in:
parent
675a5af89a
commit
f7cae4ffb5
1 changed files with 5 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue