Skip to content

Commit 7e2b31a

Browse files
committed
Add ON_DISK_VERSION constant.
1 parent 71cb59b commit 7e2b31a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/cargo/core/compiler/future_incompat.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ Each warning should contain a link for more information on what the warning
2121
means and how to resolve it.
2222
";
2323

24+
/// Current version of the on-disk format.
25+
const ON_DISK_VERSION: u32 = 0;
26+
2427
/// The future incompatibility report, emitted by the compiler as a JSON message.
2528
#[derive(serde::Deserialize)]
2629
pub struct FutureIncompatReport {
@@ -80,7 +83,7 @@ struct OnDiskReport {
8083
impl Default for OnDiskReports {
8184
fn default() -> OnDiskReports {
8285
OnDiskReports {
83-
version: 0,
86+
version: ON_DISK_VERSION,
8487
next_id: 1,
8588
reports: Vec::new(),
8689
}
@@ -161,7 +164,7 @@ impl OnDiskReports {
161164
.with_context(|| "failed to read report")?;
162165
let on_disk_reports: OnDiskReports =
163166
serde_json::from_str(&file_contents).with_context(|| "failed to load report")?;
164-
if on_disk_reports.version != 0 {
167+
if on_disk_reports.version != ON_DISK_VERSION {
165168
bail!("unable to read reports; reports were saved from a future version of Cargo");
166169
}
167170
Ok(on_disk_reports)

0 commit comments

Comments
 (0)