leptos icon indicating copy to clipboard operation
leptos copied to clipboard

Debug NodeRef Warning (#2414)

Open martinfrances107 opened this issue 1 year ago • 3 comments

This is a response to #2414

In production #[repr(transparent)] is use to ensure a compact representation in memory. In developement the memory is slightly expanded.

Things I am thinking about

A) I have introduced a maintence hazard... the documentation block for NodeRef is repeated twice So any future PRs will have to make sure things are kept in sync. I would love to avoid that...

B) I may have been over eager.. ( adding #[track_caller ] in too many places. ) impl<T: ElementDescriptor> Clone for NodeRef<T> { #[track_caller] fn clone(&self) -> Self { *self }

martinfrances107 avatar Mar 25 '24 13:03 martinfrances107

Sorry for the late reply

There is a small nuance here.

This directive is dropped for a debug build something I was hoping to avoid .

  #[repr(transparent)]

I have to do it by adding a

 #[allow(missing_docs)]

martinfrances107 avatar Apr 15 '24 17:04 martinfrances107

I recently, rebased and force pushed - as I think it will fix build errors

martinfrances107 avatar Apr 16 '24 08:04 martinfrances107

To be honest I think the CI is just unhappy

benwis avatar Apr 16 '24 22:04 benwis

Ok this next version looks much less like a dogs breakfast

#[cfg_attr(not(debug_assertions), repr(transparent)]

That was the key to this, that I was not seeing ... thank you - thank you

martinfrances107 avatar Apr 20 '24 18:04 martinfrances107

Thanks very much for the contribution, and for your patience through all the back and forth!

gbj avatar May 06 '24 12:05 gbj