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

Add num_traits proc_macro helper for explicit import #35

Merged
merged 9 commits into from Jun 27, 2020

Conversation

jean-airoldie
Copy link
Contributor

@jean-airoldie jean-airoldie commented Nov 4, 2019

This allows the user to specify a identifier for the num_traits crate
so that the proc_macros can directly depend in it.

This is usefull when reexporting num-derive and using num-trait as
a transitive import.

Fixes #34.

CC. @vglavnyy

@jean-airoldie jean-airoldie force-pushed the explicit-import branch 6 times, most recently from 1142f8d to 6cec260 Compare November 4, 2019 18:04
@jean-airoldie jean-airoldie changed the title WIP: Add num_traits proc_macro helper for explicit import Add num_traits proc_macro helper for explicit import Nov 4, 2019
@jean-airoldie jean-airoldie force-pushed the explicit-import branch 4 times, most recently from 8b1b65c to 5283f57 Compare November 6, 2019 22:41
Copy link
Member

@cuviper cuviper left a comment

Choose a reason for hiding this comment

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

This looks nice, thank you.

One request though -- I think we need a test where num-traits is really not a direct dependency. The panini test is a start, but the real num-traits will still be in the crate prelude, so we don't really know that it did the right thing. Maybe you could add another test crate like the check/ path (used for no-std), and in this case depend on the num crate with #[num_traits = "num"].

tests/explicit_import.rs Outdated Show resolved Hide resolved
@jean-airoldie
Copy link
Contributor Author

jean-airoldie commented Nov 9, 2019

Also I was wondering about the format of the helper attribute. We could also use an helper a la serde: #[num(crate = "import")], but at this points its more a matter of taste (unless some helpers are added in the future).

statiolake added a commit to statiolake/atcoder-rust-base that referenced this pull request Nov 15, 2019
The `num-derive` requires `num-traits` to be explicitly included in
Cargo.toml.  (cf. rust-num/num-derive#34)
This issue may be fixed in
rust-num/num-derive#35.
@cuviper
Copy link
Member

cuviper commented Jun 27, 2020

Hi, sorry I forgot to finish review on this. I went ahead and tinkered with it myself a bit more, and I think this is good to go.

Thanks again!

bors r+

@bors
Copy link
Contributor

bors bot commented Jun 27, 2020

@bors bors bot merged commit ed849ab into rust-num:master Jun 27, 2020
cuviper added a commit that referenced this pull request Jul 29, 2020
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.

Cannot reexport num-derive proc_macros
2 participants