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

Disable functions for i128 if not supported. #45

Closed
wants to merge 2 commits into from

Conversation

mikeleany
Copy link

@mikeleany mikeleany commented Apr 12, 2021

For targets that don't support i128 and u128, disable functions that require them in the FromPrimitive and ToPrimitive traits. This is consistent with the num-traits crate which does not require these for targets that don't support them. Fixes #46.

@mikeleany mikeleany marked this pull request as draft April 12, 2021 22:01
@mikeleany mikeleany marked this pull request as ready for review April 12, 2021 22:25
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.

I don't think this is the right change -- please see #46 (comment).

@@ -283,6 +283,7 @@ pub fn from_primitive(input: TokenStream) -> TokenStream {
<#inner_ty as #import::FromPrimitive>::from_i32(n).map(#name)
}
#[inline]
#[cfg(has_i128)]
Copy link
Member

Choose a reason for hiding this comment

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

This cfg is being emitted into the user's code, so I think it will effectively block all i128 unless they happen to have set has_i128 in the target crate.

@mikeleany
Copy link
Author

Closing as the correct solution should probably be in the autocfg crate (to resolve cuviper/autocfg#34).

@mikeleany mikeleany closed this Apr 14, 2021
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.

Compilation fails when using the -Z build-std option
2 participants