From 976260c2bd9687881863fa5413ba56178122ee45 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Sat, 25 Sep 2021 05:26:45 +0200 Subject: [PATCH] Better error if neither single_threaded or multi_threaded features is on --- egui/Cargo.toml | 2 +- epaint/src/mutex.rs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/egui/Cargo.toml b/egui/Cargo.toml index 0ee258a0..cfcda442 100644 --- a/egui/Cargo.toml +++ b/egui/Cargo.toml @@ -47,7 +47,7 @@ cint = ["epaint/cint"] persistence = ["serde", "epaint/persistence", "ron"] -# Only needed if you plan to use the same egui::Context from multiple threads. +# multi_threaded is only needed if you plan to use the same egui::Context from multiple threads. single_threaded = ["epaint/single_threaded"] multi_threaded = ["epaint/multi_threaded"] diff --git a/epaint/src/mutex.rs b/epaint/src/mutex.rs index ef23337f..dec4d86b 100644 --- a/epaint/src/mutex.rs +++ b/epaint/src/mutex.rs @@ -2,6 +2,9 @@ //! //! When the `single_threaded` feature is on the mutexes will panic when locked from different threads. +#[cfg(not(any(feature = "single_threaded", feature = "multi_threaded")))] +compile_error!("Either feature \"single_threaded\" or \"multi_threaded\" must be enabled."); + // ---------------------------------------------------------------------------- /// The lock you get from [`Mutex`].