Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug NodeRef Warning (#2414) #2467

Merged
merged 6 commits into from
May 6, 2024
Merged

Conversation

martinfrances107
Copy link
Contributor

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 {
#[track_caller]
fn clone(&self) -> Self {
*self
}

Copy link
Collaborator

@gbj gbj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this! I proposed a few small changes in the comments above. Much appreciated as always.

leptos_dom/src/node_ref.rs Outdated Show resolved Hide resolved
leptos_dom/src/node_ref.rs Outdated Show resolved Hide resolved
leptos_dom/src/node_ref.rs Outdated Show resolved Hide resolved
leptos_dom/src/node_ref.rs Outdated Show resolved Hide resolved
@martinfrances107
Copy link
Contributor Author

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
Copy link
Contributor Author

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

@benwis
Copy link
Contributor

benwis commented Apr 16, 2024

To be honest I think the CI is just unhappy

leptos_dom/src/node_ref.rs Outdated Show resolved Hide resolved
leptos_dom/src/node_ref.rs Outdated Show resolved Hide resolved
leptos_dom/src/node_ref.rs Outdated Show resolved Hide resolved
@martinfrances107
Copy link
Contributor Author

martinfrances107 commented Apr 20, 2024

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

@gbj
Copy link
Collaborator

gbj commented May 6, 2024

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

@gbj gbj merged commit 47bcee0 into leptos-rs:main May 6, 2024
43 of 59 checks passed
@martinfrances107 martinfrances107 deleted the debug_noderef branch May 6, 2024 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants