Skip to content

Commit b90cd72

Browse files
authored
Print version set on panic (#337)
Improve the panic message for astral-sh/uv#13344
1 parent 5f5e0cf commit b90cd72

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/term.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,20 +73,22 @@ impl<VS: VersionSet> Term<VS> {
7373
}
7474

7575
/// Unwrap the set contained in a positive term.
76-
/// Will panic if used on a negative set.
76+
///
77+
/// Panics if used on a negative set.
7778
pub(crate) fn unwrap_positive(&self) -> &VS {
7879
match self {
7980
Self::Positive(set) => set,
80-
_ => panic!("Negative term cannot unwrap positive set"),
81+
Self::Negative(set) => panic!("Negative term cannot unwrap positive set: {set:?}"),
8182
}
8283
}
8384

8485
/// Unwrap the set contained in a negative term.
85-
/// Will panic if used on a positive set.
86+
///
87+
/// Panics if used on a positive set.
8688
pub(crate) fn unwrap_negative(&self) -> &VS {
8789
match self {
8890
Self::Negative(set) => set,
89-
_ => panic!("Positive term cannot unwrap negative set"),
91+
Self::Positive(set) => panic!("Positive term cannot unwrap negative set: {set:?}"),
9092
}
9193
}
9294
}

0 commit comments

Comments
 (0)