Skip to content

Cannot reexport num-derive proc_macros #34

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

Closed
jean-airoldie opened this issue Nov 3, 2019 · 1 comment · Fixed by #35
Closed

Cannot reexport num-derive proc_macros #34

jean-airoldie opened this issue Nov 3, 2019 · 1 comment · Fixed by #35

Comments

@jean-airoldie
Copy link
Contributor

Since the proc_macro implementation explicity declares an extern num_traits crate, any crate that wants to use it must also depend on num-traits.

extern crate num_traits as _num_traits;

This can be a problem in case a crate reexport a num-derive proc macros because it forces the user to also depend on num-traits otherwise it produces: error[E0463]: can't find crate for _num_traits`.

Would it be possible to add a feature flag that disable this behavior? Specifically it would be the user's responsability to make sure that the num-traits crate is in scope.

jean-airoldie referenced this issue in vglavnyy/flatbuffers Nov 3, 2019
jean-airoldie added a commit to jean-airoldie/num-derive that referenced this issue Nov 3, 2019
This allows the user to specify that the `num-trait` crate is in scope.
This is usefull when reexporting `num-derive` and using `num-trait` as
a transitive import.

Fixes rust-num#34.
jean-airoldie added a commit to jean-airoldie/num-derive that referenced this issue Nov 3, 2019
This allows the user to specify that the `num-trait` crate is in scope.
This is usefull when reexporting `num-derive` and using `num-trait` as
a transitive import.

Fixes rust-num#34.
jean-airoldie added a commit to jean-airoldie/num-derive that referenced this issue Nov 4, 2019
This allows the user to specify a identifier for the `num_traits` crate
so that the proc_macro can directly depend in it.

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

Fixes rust-num#34.
@jean-airoldie
Copy link
Contributor Author

A better solution would be to provide a proc_macro helper attribute that allows the user to specify an explicit import identifier. If no such helper if present, the proc_macro would default to the current behavior.

jean-airoldie added a commit to jean-airoldie/num-derive that referenced this issue Nov 4, 2019
This allows the user to specify a identifier for the `num_traits` crate
so that the proc_macro can directly depend in it.

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

Fixes rust-num#34.
jean-airoldie added a commit to jean-airoldie/num-derive that referenced this issue Nov 4, 2019
This allows the user to specify a identifier for the `num_traits` crate
so that the proc_macro can directly depend in it.

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

Fixes rust-num#34.
jean-airoldie added a commit to jean-airoldie/num-derive that referenced this issue Nov 4, 2019
This allows the user to specify a identifier for the `num_traits` crate
so that the proc_macro can directly depend in it.

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

Fixes rust-num#34.
jean-airoldie added a commit to jean-airoldie/num-derive that referenced this issue Nov 4, 2019
This allows the user to specify a identifier for the `num_traits` crate
so that the proc_macro can directly depend in it.

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

Fixes rust-num#34.
jean-airoldie added a commit to jean-airoldie/num-derive that referenced this issue Nov 4, 2019
This allows the user to specify a identifier for the `num_traits` crate
so that the proc_macro can directly depend in it.

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

Fixes rust-num#34.
jean-airoldie added a commit to jean-airoldie/num-derive that referenced this issue Nov 4, 2019
This allows the user to specify a identifier for the `num_traits` crate
so that the proc_macro can directly depend in it.

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

Fixes rust-num#34.
jean-airoldie added a commit to jean-airoldie/num-derive that referenced this issue Nov 5, 2019
This allows the user to specify a identifier for the `num_traits` crate
so that the proc_macro can directly depend in it.

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

Fixes rust-num#34.
jean-airoldie added a commit to jean-airoldie/num-derive that referenced this issue Nov 6, 2019
This allows the user to specify a identifier for the `num_traits` crate
so that the proc_macro can directly depend in it.

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

Fixes rust-num#34.
jean-airoldie added a commit to jean-airoldie/num-derive that referenced this issue Nov 6, 2019
This allows the user to specify a identifier for the `num_traits` crate
so that the proc_macro can directly depend in it.

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

Fixes rust-num#34.
jean-airoldie added a commit to jean-airoldie/num-derive that referenced this issue Nov 6, 2019
This allows the user to specify a identifier for the `num_traits` crate
so that the proc_macro can directly depend in it.

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

Fixes rust-num#34.
jean-airoldie added a commit to jean-airoldie/num-derive that referenced this issue Nov 9, 2019
This allows the user to specify a identifier for the `num_traits` crate
so that the proc_macro can directly depend in it.

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

Fixes rust-num#34.
statiolake added a commit to statiolake/atcoder-rust-base that referenced this issue 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.
bors bot added a commit that referenced this issue Jun 27, 2020
35: Add `num_traits` proc_macro helper for explicit import r=cuviper a=jean-airoldie

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

Co-authored-by: jean-airoldie <[email protected]>
Co-authored-by: Josh Stone <[email protected]>
@bors bors bot closed this as completed in 1da2450 Jun 27, 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 a pull request may close this issue.

1 participant