fix(no_std): provide f64 polyfills for no_std compatibility#1840
Merged
joshka merged 15 commits intoratatui:mainfrom May 13, 2025
Merged
fix(no_std): provide f64 polyfills for no_std compatibility#1840joshka merged 15 commits intoratatui:mainfrom
f64 polyfills for no_std compatibility#1840joshka merged 15 commits intoratatui:mainfrom
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since a lot of float methods are not included in
core, I decided to make a simple polyfills crate, so we don't have to conditionally compile every place where these methods are used.This adds a dependency, that does nothing if we use
std. We can either:std-polyfills(orno-std) feature flag (additional tostd). I did something like that here: fix(no_std): final patches needed for no_std #1833.This has one drawback - we have to use either
stdorstd-polyfillsfeature flag or the library won't compile.To make it easier on the user, we can add a check in lib.rs that emitts compiler error "either std or std-polyfills feature flag must be enabled" in such cases.
float-polyfillscrate lighter, not depending on libm (or gate libm behind feature flag).Let me know what you think and if you have some other ideas for this.
Related: rust-lang/rust#137578