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

Rewrite and test the Bundle derive macro #104

Merged
merged 4 commits into from
Oct 28, 2020
Merged

Conversation

Veykril
Copy link
Contributor

@Veykril Veykril commented Oct 28, 2020

This PR adds tests for the derive macro, makes it hygienic and fixes it not working for tuple structs and unit structs(though I guess unit structs are kind of pointless to use?).

I wanted to tackle adding generics but figured adding proper testing first would make more sense.

Copy link
Owner

@Ralith Ralith left a comment

Choose a reason for hiding this comment

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

Thanks, this is great! No serious issues, though if you want to rewrite the history a bit we could rebase rather than squashing and keep history a little more discrete.

though I guess unit structs are kind of pointless to use?

I could imagine them coming up occasionally with feature-gated or macro-generated component fields. Definitely worth supporting, given that it's not hugely difficult to do so.

.as_ptr();
)*
Ok(Self { #( #fields: #fields.read(), )* })
}
Copy link
Owner

Choose a reason for hiding this comment

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

Rather than having two code paths here, could we resolve the issue with type annotations?

tests/derive.rs Outdated Show resolved Hide resolved
macros/src/lib.rs Show resolved Hide resolved
tests/derive.rs Show resolved Hide resolved
@Veykril
Copy link
Contributor Author

Veykril commented Oct 28, 2020

Alright, the history should be cleaner now

@Veykril
Copy link
Contributor Author

Veykril commented Oct 28, 2020

Ah dammit i pushed the generics test file by accident now

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.

2 participants