servo / euclid

Geometry primitives (basic linear algebra) for Rust
Other
462 stars 103 forks source link

Fix compile of `arbitrary` feature. #505

Closed kpreid closed 10 months ago

kpreid commented 10 months ago

The arbitrary feature is currently broken, because the Arbitrary derive macro assumes std is present:

$ cargo build --features arbitrary
   Compiling euclid v0.22.9 (/Users/kpreid/Projects/rust/contributing/euclid)
error[E0433]: failed to resolve: use of undeclared crate or module `std`
  --> src/angle.rs:26:42
   |
26 | #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
   |                                          ^^^^^^^^^^^^^^^^^^^^ use of undeclared crate or module `std`
   |
   = note: this error originates in the derive macro `arbitrary::Arbitrary` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0425]: cannot find value `RECURSIVE_COUNT_Angle` in this scope
  --> src/angle.rs:26:42
   |
26 | #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
   |                                          ^^^^^^^^^^^^^^^^^^^^ not found in this scope
   |
   = note: this error originates in the derive macro `arbitrary::Arbitrary` (in Nightly builds, run with -Z macro-backtrace for more info)

This PR replaces the sole use of that macro with a manual implementation, and adds CI testing for the feature so it won't break again.