diff --git a/vhost-user-backend/Cargo.toml b/vhost-user-backend/Cargo.toml index df840c0..33ba4b3 100644 --- a/vhost-user-backend/Cargo.toml +++ b/vhost-user-backend/Cargo.toml @@ -29,7 +29,10 @@ vhost = { path = "../vhost", version = "0.14.0", features = ["test-utils", "vhos vm-memory = { workspace = true, features = ["backend-mmap", "backend-atomic"] } tempfile = "3.2.0" +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(RUSTDOC_disable_feature_compat_errors)'] } + [package.metadata.cargo-all-features] skip_feature_sets = [ ["xen", "postcopy"] -] \ No newline at end of file +] diff --git a/vhost-user-backend/src/lib.rs b/vhost-user-backend/src/lib.rs index 7e1db9e..7ade20a 100644 --- a/vhost-user-backend/src/lib.rs +++ b/vhost-user-backend/src/lib.rs @@ -36,10 +36,15 @@ pub use self::vring::{ VringMutex, VringRwLock, VringState, VringStateGuard, VringStateMutGuard, VringT, }; -/// Due to the way `xen` handles memory mappings we can not combine it with -/// `postcopy` feature which relies on persistent memory mappings. Thus we -/// disallow enabling both features at the same time. -#[cfg(all(feature = "postcopy", feature = "xen"))] +// Due to the way `xen` handles memory mappings we can not combine it with +// `postcopy` feature which relies on persistent memory mappings. Thus we +// disallow enabling both features at the same time. +#[cfg(all( + not(RUSTDOC_disable_feature_compat_errors), + not(doc), + feature = "postcopy", + feature = "xen" +))] compile_error!("Both `postcopy` and `xen` features can not be enabled at the same time."); /// An alias for `GuestMemoryAtomic>` to simplify code. diff --git a/vhost/Cargo.toml b/vhost/Cargo.toml index 88a02c3..c372c9e 100644 --- a/vhost/Cargo.toml +++ b/vhost/Cargo.toml @@ -38,6 +38,9 @@ vm-memory = { workspace = true, features=["backend-mmap"] } tempfile = "3.2.0" serial_test = "3.0" +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(RUSTDOC_disable_feature_compat_errors)'] } + [package.metadata.cargo-all-features] skip_feature_sets = [ ["xen", "postcopy"] diff --git a/vhost/src/lib.rs b/vhost/src/lib.rs index 6a2c0e1..1393cf3 100644 --- a/vhost/src/lib.rs +++ b/vhost/src/lib.rs @@ -51,10 +51,15 @@ pub mod vhost_user; #[cfg(feature = "vhost-vsock")] pub mod vsock; -/// Due to the way `xen` handles memory mappings we can not combine it with -/// `postcopy` feature which relies on persistent memory mappings. Thus we -/// disallow enabling both features at the same time. -#[cfg(all(not(doc), feature = "postcopy", feature = "xen"))] +// Due to the way `xen` handles memory mappings we can not combine it with +// `postcopy` feature which relies on persistent memory mappings. Thus we +// disallow enabling both features at the same time. +#[cfg(all( + not(RUSTDOC_disable_feature_compat_errors), + not(doc), + feature = "postcopy", + feature = "xen" +))] compile_error!("Both `postcopy` and `xen` features can not be enabled at the same time."); /// Error codes for vhost operations