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

nostd feature #360

Closed
roblabla opened this issue Dec 22, 2017 · 6 comments
Closed

nostd feature #360

roblabla opened this issue Dec 22, 2017 · 6 comments

Comments

@roblabla
Copy link

Hey, it'd be nice if this crate could support nostd. My use-case is that I'd like to use this crate on a platform that doesn't provide an std, but still has an allocator (which I think is the only required bit for most of the crates in here ?). Is this something you'd be willing to accept PRs for ?

@cuviper
Copy link
Member

cuviper commented Dec 23, 2017

We tried this already for num-traits -- #296, then had to yank it -- #297. It was gating Float from no-std because of missing trig functions, IIRC, but it's a breaking change to add a #[cfg(feature=...)] on something that was formerly unconditional. If we can find a way to implement no-std num-traits without any loss of functionality, I guess that would be OK. Refer now to rust-num/num-traits#16.

(I don't think a breaking semver bump to num-traits is likely any time soon. It's so much of a public dependency that I expect that would be very painful for everyone to migrate.)

It might actually be OK to do no-std in num-bigint (with alloc::vec::Vec) before all that, if it doesn't implement num-traits in that case. Other crates would be a lot harder without the traits.

@cuviper
Copy link
Member

cuviper commented Dec 23, 2017

I'd like to use this crate on a platform that doesn't provide an std, but still has an allocator

Just curious, if you can share, which platform is that?

@roblabla
Copy link
Author

roblabla commented Dec 23, 2017 via email

@hcpl
Copy link

hcpl commented Dec 23, 2017

It will break crates that use num with no-default-features.

From @cuviper's link's link (servo/euclid#210):

the latest release of num_traits adds a new std default feature. euclid is using no-default features of num_traits, in which Float is not available.

@roblabla
Copy link
Author

Well, I can see two solutions then :

  • Using a nostd feature instead, that disables std support.
  • Using the semver trick to add the feature without splitting the ecosystem.

@cuviper
Copy link
Member

cuviper commented Dec 27, 2017

Features need to be additive. Otherwise, one crate which uses num-traits/nostd would break any other crate in that build that needed the disabled functionality.

The semver trick might be perfect though. Publish 0.2 with the feature changes, then re-export it with full std support in 0.1.

@cuviper cuviper mentioned this issue Jun 23, 2018
bors bot added a commit that referenced this issue Jun 30, 2018
367: Release 0.2.0 r=cuviper a=cuviper

Closes #298.
Closes #357.
Closes #360.

Co-authored-by: Josh Stone <[email protected]>
Co-authored-by: Christopher Durham <[email protected]>
@bors bors bot closed this as completed in #367 Jun 30, 2018
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

No branches or pull requests

3 participants