Skip to content

Make euclid build without libm#543

Merged
nical merged 2 commits intoservo:mainfrom
nical:nostd-nolibm2
Mar 17, 2026
Merged

Make euclid build without libm#543
nical merged 2 commits intoservo:mainfrom
nical:nostd-nolibm2

Conversation

@nical
Copy link
Copy Markdown
Contributor

@nical nical commented Apr 18, 2025

Currently euclid can build in a no-std environment only if the libm feature is enabled. As a result, downstream crates that want to support no-std have to either add a libm feature or force the libm dependency even in the default std configuration.
There are users of euclid that don't need the float math functionality that is provided by std/libm, For example etagere and guillotiere that mostly use the types in their public API and some simple rectangle functionality that doesn't require libm.

This PR aims to address that by sprinkling #[cfg(any(feature = "std", feature = "libm"))] until euclid builds with --no-default-features.
It isn't super pretty, but it's simple to review and can be easily followed up with a patch that consolidates all of these #[cfg] into a single per type in front of an impl block for all of the functions that need libm/std.

@nicoburns
Copy link
Copy Markdown
Contributor

The arbitrary and malloc_size_of impl's seem to have diappeared from vector.rs. Otherwise this looks good to me.

@nical
Copy link
Copy Markdown
Contributor Author

nical commented Feb 26, 2026

Oh boy. The rebase clobbered a ton of unrelated changes.

@nical nical added this pull request to the merge queue Mar 17, 2026
Merged via the queue into servo:main with commit 9731a47 Mar 17, 2026
21 checks passed
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.

3 participants