Fix cargo build -p geo_filters --features serde#102
Conversation
This previously failed with
```
❯ cargo build -p geo_filters --features serde
Compiling geo_filters v0.1.0 (/Users/jorendorff/src/rust-gems/crates/geo_filters)
error[E0433]: failed to resolve: could not find `Deserialize` in `serde`
--> crates/geo_filters/src/diff_count/sim_hash.rs:28:45
|
28 | #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
| ^^^^^^^^^^^ could not find `Deserialize` in `serde`
|
note: found an item that was configured out
--> /Users/jorendorff/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/serde-1.0.214/src/lib.rs:343:24
|
341 | #[cfg(feature = "serde_derive")]
| ------------------------ the item is gated behind the `serde_derive` feature
342 | #[cfg_attr(docsrs, doc(cfg(feature = "derive")))]
343 | pub use serde_derive::{Deserialize, Serialize};
| ^^^^^^^^^^^
```
...and two other similar errors.
There was a problem hiding this comment.
Pull request overview
Fixes the geo_filters crate failing to compile when enabling the serde feature by ensuring Serde’s derive macros are available, and adds a Makefile check to prevent similar feature-gating regressions.
Changes:
- Enable Serde’s
derivefeature for the optionalserdedependency to makeserde::Serialize/serde::Deserializeavailable. - Bump
geo_filterscrate version to0.1.1. - Add
cargo checkinvocations inmake testto validate buildinggeo_filterswith no features and with individual features enabled.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/geo_filters/Cargo.toml | Enables serde derives under the serde feature and bumps the crate version. |
| Makefile | Adds per-feature cargo check to catch feature-specific build failures early. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| cargo check -p geo_filters --features test-support | ||
| cargo check -p geo_filters --features serde | ||
| cargo check -p geo_filters --features evaluation |
There was a problem hiding this comment.
The comment says each feature is compiled “in isolation”, but the per-feature cargo check commands don’t pass --no-default-features. That’s equivalent today because default = [], but if default features are added later these checks will no longer validate isolation. Consider adding --no-default-features to the test-support/serde/evaluation checks as well (or updating the comment).
| cargo check -p geo_filters --features test-support | |
| cargo check -p geo_filters --features serde | |
| cargo check -p geo_filters --features evaluation | |
| cargo check -p geo_filters --no-default-features --features test-support | |
| cargo check -p geo_filters --no-default-features --features serde | |
| cargo check -p geo_filters --no-default-features --features evaluation |
This previously failed with
...and two other similar errors.
It'd be nice to make a release once this merges, so I bumped the version number.