Skip to content

Euclid fails to build with default-features = false #544

@paxbun

Description

@paxbun

Euclid 0.22.11 fails to build due to the occurrences of num_traits::real or num_traits::Float when neither std nor libm is enabled.

Reproduction

  1. Rust 1.85 is used.
> rustc --version --verbose
rustc 1.85.0 (4d91de4e4 2025-02-17)
binary: rustc
commit-hash: 4d91de4e48198da2e33413efdcd9cd2cc0c46688
commit-date: 2025-02-17
host: aarch64-apple-darwin
release: 1.85.0
LLVM version: 19.1.7
  1. Clone euclid.
git clone https://github.com/servo/euclid
  1. Checkout to the 0.22.11 commit ed102fa.
git checkout ed102fa314115820ee22d47e587a38ef6c4c7826
  1. Build with default features disabled.
cargo build --no-default-features

Result

   Compiling euclid v0.22.11 (/Users/paxbun/Projects/Others/euclid)
error[E0432]: unresolved import `num_traits::real`
  --> src/angle.rs:20:17
   |
20 | use num_traits::real::Real;
   |                 ^^^^ could not find `real` in `num_traits`
   |
note: found an item that was configured out
  --> /Users/paxbun/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-traits-0.2.19/src/lib.rs:62:9
   |
62 | pub mod real;
   |         ^^^^
note: the item is gated here
  --> /Users/paxbun/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-traits-0.2.19/src/real.rs:1:1
   |
1  | #![cfg(any(feature = "std", feature = "libm"))]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0432]: unresolved import `num_traits::Float`
  --> src/angle.rs:21:18
   |
21 | use num_traits::{Float, FloatConst, NumCast, One, Zero};
   |                  ^^^^^
   |                  |
   |                  no `Float` in the root
   |                  help: a similar name exists in the module (notice the capitalization): `float`
   |
note: found an item that was configured out
  --> /Users/paxbun/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-traits-0.2.19/src/lib.rs:32:23
   |
32 | pub use crate::float::Float;
   |                       ^^^^^
note: the item is gated here
  --> /Users/paxbun/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/num-traits-0.2.19/src/lib.rs:31:1
   |
31 | #[cfg(any(feature = "std", feature = "libm"))]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

...

Some errors have detailed explanations: E0432, E0433.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `euclid` (lib) due to 28 previous errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions