From 52be548680ce8d4d19b53360bf4a462b97f53e3d Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Mon, 16 Aug 2021 15:48:48 +0200 Subject: [PATCH] feat(vfs) Make `host_fs` and `mem_fs` mutually exclusives. This patch generates a compiler error if `host_fs` and `mem_fs` are both enabled at compile-time. It also generates a compiler error if none of them have been enabled. --- lib/vfs/src/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/vfs/src/lib.rs b/lib/vfs/src/lib.rs index 601a8d7915c..77eb095cf75 100644 --- a/lib/vfs/src/lib.rs +++ b/lib/vfs/src/lib.rs @@ -6,6 +6,12 @@ use std::path::{Path, PathBuf}; use thiserror::Error; use tracing::debug; +#[cfg(all(not(feature = "host_fs"), not(feature = "mem_fs")))] +compile_error!("At least the `host_fs` or the `mem_fs` feature must be enabled. Please, pick one."); + +#[cfg(all(feature = "host_fs", feature = "mem_fs"))] +compile_error!("The `host_fs` and `mem_fs` features are mutually exclusive."); + #[cfg(feature = "host_fs")] pub mod host_fs; //pub mod vfs_fs;