Place NdFloat and num-traits/std behind a new "std" feature#861
Place NdFloat and num-traits/std behind a new "std" feature#861xd009642 merged 1 commit intorust-ndarray:masterfrom xd009642:float_core
Conversation
|
So this is designed as a PoC on a potential |
|
I don't see where the new std feature is added here (in Cargo.toml). Make sure you add that too. |
|
Oops forgot to add to the commit. I ran a cargo fmt and it changed pretty much everything so missed the cargo.toml when adding just non-fmt changes 😬 |
|
Well tests pass so I guess I'll mark this as ready to review. As a summary of the motivation behind this PR. It is some initial work for #708 This adds an std feature and makes the std feature of num-traits optional. It adds std to the default features so no breaking changes for crates that don't specify For the tests that use |
Num-traits Float says it can be used with no-std in this way. So we have exactly this problem: https://stackoverflow.com/questions/61769086/ (using std or libm but not both at the same time), with corresponding cargo feature request rust-lang/cargo#1839 |
|
@bluss Now that you mention it, we should probably just require the libm feature. I think that the crate doesn't use libm if the std feature is present, but I haven't double checked yet. This would take care of this float problem. |
|
We don't want to have the extra build time of libm if we don't use it. |
|
So @bluss I've removed |
|
Thanks, makes sense to me to do this piecemeal, even though I made a suggestion make most of the PR disappear :) Could you update PR title and description before merge? I'd also rebase/squash it all together in this case I think (as you want). Lgtm. |
|
@bluss renamed, redescribed, and squashed 😄 |
|
Thanks! |
|
You can merge it, since you can |
|
my first merge to ndarray 🎉 |
This PR adds a new default feature "std" and when present this activates the "std" feature in num-traits and includes the
NdFloattrait defined in ndarray. This is part of the tasks required in order to provide ano_std + allocversion of ndarray for issue #708This is (an unavoidable) breaking change for any users that set
default-features = false, other ndarray users will be unaffected.