Skip to content

Commit

Permalink
fixes (#110)
Browse files Browse the repository at this point in the history
* Various improvements

* fix validation
  • Loading branch information
andersmusikkahs authored Nov 21, 2024
1 parent 8c8a3d2 commit e1e74d2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions savefile-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
}
}
};
}
Expand Down

0 comments on commit e1e74d2

Please sign in to comment.