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

[BREAKING] Remove derive(*) #44

Closed
greyblake opened this issue Jun 29, 2023 · 1 comment
Closed

[BREAKING] Remove derive(*) #44

greyblake opened this issue Jun 29, 2023 · 1 comment

Comments

@greyblake
Copy link
Owner

greyblake commented Jun 29, 2023

It was controversial experiment from the very beginning.
At this point we want to get rid of it.

See also:
https://www.reddit.com/r/rust/comments/14j7w46/comment/jpzag6f/?utm_source=reddit&utm_medium=web2x&context=3

Context

At the moment in version 0.3.1 it's possible to derive traits with #[derive(*)], where * means traits that make sense "by default".

You can find those traits be search for fn unfold_asterisk_traits in the code.

Spec

  • In crate nutype_macros
  • Remove code related to parsing * in derive and the logic that unfolds it.
  • Generate a friendly message at compile time, saying that #[derive(*)] is no longer possible.
  • Adjust all the tests that are necessary (run all tests with make test)
  • Add a note in the CHANGELOG about the breaking change

Acceptance Criteria

I have the following code:

#[nutype()]
#[derive(*)]
pub struct Name(String);

It does not compile. Th error message points to

#[derive(*)]
         ^

The same applies if the inner type is integer of float.

@greyblake greyblake changed the title Consider moving derive(*) behind feature flag [BREAKING] Consider moving derive(*) behind feature flag Jul 4, 2023
@greyblake greyblake changed the title [BREAKING] Consider moving derive(*) behind feature flag [BREAKING] Remove derive(*) Jul 13, 2023
@greyblake
Copy link
Owner Author

Addressed in #60

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

No branches or pull requests

1 participant