Skip to content

Commit

Permalink
Fix index_v version check.
Browse files Browse the repository at this point in the history
The whole point is that when loading a cache from an earlier version,
that cache may be missing new entries. So don't load older caches.
  • Loading branch information
ehuss committed Feb 20, 2021
1 parent 0d4137f commit f258569
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cargo/sources/registry/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -708,9 +708,9 @@ impl<'a> SummariesCache<'a> {
.get(..4)
.ok_or_else(|| anyhow::anyhow!("cache expected 4 bytes for index version"))?;
let index_v = u32::from_le_bytes(index_v_bytes.try_into().unwrap());
if index_v > INDEX_V_MAX {
if index_v != INDEX_V_MAX {
bail!(
"index format version {} is greater than the newest version I know ({})",
"index format version {} doesn't match the version I know ({})",
index_v,
INDEX_V_MAX
);
Expand Down

0 comments on commit f258569

Please sign in to comment.