Skip to content

Add num_traits proc_macro helper for explicit import#35

Merged
bors[bot] merged 9 commits into
rust-num:masterfrom
jean-airoldie:explicit-import
Jun 27, 2020
Merged

Add num_traits proc_macro helper for explicit import#35
bors[bot] merged 9 commits into
rust-num:masterfrom
jean-airoldie:explicit-import

Conversation

@jean-airoldie

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

Copy link
Copy Markdown
Contributor

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

@cuviper cuviper left a comment

Copy link
Copy Markdown
Member

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"].

Comment thread tests/explicit_import.rs Outdated
@jean-airoldie

jean-airoldie commented Nov 9, 2019

Copy link
Copy Markdown
Contributor Author

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

cuviper commented Jun 27, 2020

Copy link
Copy Markdown
Member

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

bors Bot commented Jun 27, 2020

Copy link
Copy Markdown
Contributor

@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