diff --git a/src/cargo/core/resolver/version_prefs.rs b/src/cargo/core/resolver/version_prefs.rs index e84d24ba066..963088c24e5 100644 --- a/src/cargo/core/resolver/version_prefs.rs +++ b/src/cargo/core/resolver/version_prefs.rs @@ -283,4 +283,13 @@ mod test { .to_string() ); } + + #[should_panic = "`at` split index (is 1) should be <= len (is 0)"] + #[test] + fn test_empty_summaries() { + let vp = VersionPreferences::default(); + let mut summaries = vec![]; + + vp.sort_summaries(&mut summaries, Some(VersionOrdering::MaximumVersionsFirst)); + } }