Closed
Description
The file exists to trigger a compiler error when the user uses an invalid combination of features:
json/src/features_check/error.rs
Line 1 in 2e15e3d
json/src/features_check/mod.rs
Lines 10 to 13 in 2e15e3d
The invalid code interferes with static analysis tools like cargo-geiger:
$ cargo-geiger --version
cargo-geiger 0.11.7
$ cargo geiger
...
Failed to parse file: /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde_json-1.0.115/src/features_check/error.rs, Syn(Error("expected one of: `fn`, `extern`, `use`, `static`, `const`, `unsafe`, `mod`, `type`, `struct`, `enum`, `union`, `trait`, `auto`, `impl`, `default`, `macro`, identifier, `self`, `super`, `crate`, `::`"), "/Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde_json-1.0.115/src/features_check/error.rs")
...
Let replace the invalid code with a call to the std::compile_error!
macro:
#[cfg(not(any(feature = "std", feature = "alloc")))]
compile_error!("serde_json requires that either `std` (default) or `alloc` feature is enabled");
Metadata
Metadata
Assignees
Labels
No labels