From 3fa519563e08f9fcd09af8304d59874d717932f3 Mon Sep 17 00:00:00 2001 From: niedzwiedzw Date: Wed, 12 Jul 2023 12:27:17 +0200 Subject: [PATCH] prevent inlining --- packages/hooks/src/use_shared_state.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/hooks/src/use_shared_state.rs b/packages/hooks/src/use_shared_state.rs index 8e9a05c29..cc1679b09 100644 --- a/packages/hooks/src/use_shared_state.rs +++ b/packages/hooks/src/use_shared_state.rs @@ -44,6 +44,7 @@ pub mod diagnostics { impl super::UseSharedState { #[cfg_attr(debug_assertions, track_caller)] + #[cfg_attr(debug_assertions, inline(never))] #[allow(unused_must_use)] pub(super) fn debug_track_borrow(&self) { #[cfg(debug_assertions)] @@ -53,6 +54,7 @@ pub mod diagnostics { } #[cfg_attr(debug_assertions, track_caller)] + #[cfg_attr(debug_assertions, inline(never))] #[allow(unused_must_use)] pub(super) fn debug_track_borrow_mut(&self) { #[cfg(debug_assertions)] @@ -63,6 +65,7 @@ pub mod diagnostics { } impl PreviousBorrow { #[track_caller] + #[inline(never)] pub fn borrowed() -> Self { Self { location: *Location::caller(), @@ -71,6 +74,7 @@ pub mod diagnostics { } #[track_caller] + #[inline(never)] pub fn borrowed_mut() -> Self { Self { location: *Location::caller(), @@ -257,6 +261,7 @@ impl UseSharedState { /// Try reading the shared state #[cfg_attr(debug_assertions, track_caller)] + #[cfg_attr(debug_assertions, inline(never))] pub fn try_read(&self) -> UseSharedStateResult> { self.inner .try_borrow() @@ -275,6 +280,7 @@ impl UseSharedState { /// Read the shared value #[cfg_attr(debug_assertions, track_caller)] + #[cfg_attr(debug_assertions, inline(never))] pub fn read(&self) -> Ref<'_, T> { match self.try_read() { Ok(value) => value, @@ -287,6 +293,7 @@ impl UseSharedState { /// Try writing the shared state #[cfg_attr(debug_assertions, track_caller)] + #[cfg_attr(debug_assertions, inline(never))] pub fn try_write(&self) -> UseSharedStateResult> { self.inner .try_borrow_mut() @@ -309,6 +316,7 @@ impl UseSharedState { /// // TODO: We prevent unncessary notifications only in the hook, but we should figure out some more global lock #[cfg_attr(debug_assertions, track_caller)] + #[cfg_attr(debug_assertions, inline(never))] pub fn write(&self) -> RefMut<'_, T> { match self.try_write() { Ok(value) => value, @@ -321,6 +329,7 @@ impl UseSharedState { /// Tries writing the value without forcing a re-render #[cfg_attr(debug_assertions, track_caller)] + #[cfg_attr(debug_assertions, inline(never))] pub fn try_write_silent(&self) -> UseSharedStateResult> { self.inner .try_borrow_mut() @@ -339,6 +348,7 @@ impl UseSharedState { /// Writes the value without forcing a re-render #[cfg_attr(debug_assertions, track_caller)] + #[cfg_attr(debug_assertions, inline(never))] pub fn write_silent(&self) -> RefMut<'_, T> { match self.try_write_silent() { Ok(value) => value,