From e1e74d2ac3d455051dfef17a7ef94262e219acbe Mon Sep 17 00:00:00 2001 From: andersmusikkahs Date: Thu, 21 Nov 2024 20:33:01 +0100 Subject: [PATCH] fixes (#110) * Various improvements * fix validation --- savefile-derive/src/lib.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/savefile-derive/src/lib.rs b/savefile-derive/src/lib.rs index f4e3cda..7c3fd8a 100644 --- a/savefile-derive/src/lib.rs +++ b/savefile-derive/src/lib.rs @@ -221,10 +221,15 @@ mod savefile_abi; static HAVE_EMITTED_ASSERT_TIGHT: AtomicBool = AtomicBool::new(false); fn assert_tight() -> TokenStream { if HAVE_EMITTED_ASSERT_TIGHT.compare_exchange(false, true, Ordering::Relaxed, Ordering::Relaxed).is_ok() { + let tight = cfg!(feature="tight"); quote! { const _ASSERT_TIGHT:() = { - if cfg!(feature="tight") != savefile::TIGHT { - panic!("The feature 'tight' must be enabled in both savefile and savefile_derive, or in neither."); + if #tight != savefile::TIGHT { + if savefile::TIGHT { + panic!("The feature 'tight' must be enabled in both savefile and savefile_derive, or in neither. It is only enabled in savefile."); + } else { + panic!("The feature 'tight' must be enabled in both savefile and savefile_derive, or in neither. It is only enabled in savefile-derive."); + } } }; }