Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace features_check mod with a call to std::compile_error!. #1124

Merged
merged 1 commit into from Apr 16, 2024

Conversation

mleonhard
Copy link
Contributor

@mleonhard mleonhard commented Apr 15, 2024

This PR fixes #1123 .

Manual test:

% cat Cargo.toml 
[package]
name = "fork-serde-rs-json-test"
version = "0.1.0"
edition = "2021"

[dependencies]
serde_json = { path = "../fork-serde-rs-json", default-features = false, features = ["alloc"] }
% cargo build   
   Compiling serde v1.0.197
   Compiling serde_json v1.0.115 (/Users/user/fork-serde-rs-json)
   Compiling ryu v1.0.17
   Compiling itoa v1.0.11
   Compiling fork-serde-rs-json-test v0.1.0 (/Users/user/fork-serde-rs-json-test)
    Finished dev [unoptimized + debuginfo] target(s) in 5.07s
% cat Cargo.toml
[package]
name = "fork-serde-rs-json-test"
version = "0.1.0"
edition = "2021"

[dependencies]
serde_json = { path = "../fork-serde-rs-json", default-features = false, features = ["std"] }
% cargo build   
   Compiling serde v1.0.197
   Compiling serde_json v1.0.115 (/Users/user/fork-serde-rs-json)
   Compiling fork-serde-rs-json-test v0.1.0 (/Users/user/fork-serde-rs-json-test)
    Finished dev [unoptimized + debuginfo] target(s) in 5.73s
% cat Cargo.toml
[package]
name = "fork-serde-rs-json-test"
version = "0.1.0"
edition = "2021"

[dependencies]
serde_json = { path = "../fork-serde-rs-json", default-features = false, features = [] }
% cargo build   
   Compiling serde v1.0.197
   Compiling serde_json v1.0.115 (/Users/user/fork-serde-rs-json)
error: serde_json requires that either `std` (default) or `alloc` feature is enabled
   --> /Users/user/fork-serde-rs-json/src/lib.rs:367:1
    |
367 | compile_error!("serde_json requires that either `std` (default) or `alloc` feature is enabled");
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: could not compile `serde_json` (lib) due to 1 previous error

Copy link
Member

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@dtolnay dtolnay merged commit 051ce97 into serde-rs:master Apr 16, 2024
13 checks passed
@dtolnay
Copy link
Member

dtolnay commented Apr 16, 2024

Published in serde_json 1.0.116.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

features_check/error.rs interferes with static analysis
2 participants