From edd3f59fd54c4b6a7108ac5b4389c499e996b265 Mon Sep 17 00:00:00 2001 From: Erik Schilling Date: Mon, 18 Dec 2023 07:05:49 +0100 Subject: [PATCH] Fail build on non 64-bit targets As discussed on Slack and during sync meetings, we should make it explicit that we only support 64bit. While other architectures may be viable to support, currently we assume that usize == u64 and nobody expressed interest in 32bit support. Signed-off-by: Erik Schilling --- CHANGELOG.md | 1 + src/lib.rs | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fadaa00..58772f3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Added ### Changed +- [[#275](https://github.com/rust-vmm/vm-memory/pull/275)] Fail builds on non 64-bit platforms. ### Fixed ### Removed ### Deprecated diff --git a/src/lib.rs b/src/lib.rs index 6688b1d6..a9342235 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -20,6 +20,10 @@ #![deny(missing_docs)] #![deny(missing_debug_implementations)] +// We only support 64bit. Fail build when attempting to build other targets +#[cfg(not(target_pointer_width = "64"))] +compile_error!("vm-memory only supports 64-bit targets!"); + #[macro_use] pub mod address; pub use address::{Address, AddressValue};