Skip to content

Commit

Permalink
host: main: fix cast-checking assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
henrytill committed Oct 14, 2024
1 parent 5dbfa38 commit 98cdf4a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion host/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::{
env, fs,
io::{self, BufReader, BufWriter, Read, Write},
mem,
};

use anyhow::Error;
Expand All @@ -13,7 +14,7 @@ use noematic::{
};

// We use unchecked casts to convert u32 to usize.
const _: () = assert!(usize::MAX >= u32::MAX as usize);
const _: () = assert!(mem::size_of::<usize>() >= mem::size_of::<u32>());

const MSG_MISSING_HOME_DIR: &str = "Missing home directory";
const MSG_UNSUPPORTED_VERSION: &str = "Unsupported version";
Expand Down

0 comments on commit 98cdf4a

Please sign in to comment.