From 6124f8e8eb30ee16667a3f3297bb69cf92aee528 Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Fri, 2 Dec 2022 14:03:15 -0800 Subject: [PATCH] wgpu-hal: Give a more helpful error when no backends are enabled. --- wgpu-hal/src/lib.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/wgpu-hal/src/lib.rs b/wgpu-hal/src/lib.rs index b688e326d69..dcce62899d5 100644 --- a/wgpu-hal/src/lib.rs +++ b/wgpu-hal/src/lib.rs @@ -49,6 +49,15 @@ clippy::pattern_type_mismatch, )] +#[cfg(not(any( + feature = "dx11", + feature = "dx12", + feature = "gles", + feature = "metal", + feature = "vulkan" +)))] +compile_error!("No back ends enabled in `wgpu-hal`. Enable at least one backend feature."); + #[cfg(all(feature = "metal", not(any(target_os = "macos", target_os = "ios"))))] compile_error!("Metal API enabled on non-Apple OS. If your project is not using resolver=\"2\" in Cargo.toml, it should."); #[cfg(all(feature = "dx12", not(windows)))]