Skip to content

Commit

Permalink
Add user-friendly error when no alloc or std feature are enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Xanewok committed Jan 21, 2020
1 parent 176ff71 commit 7852d2f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/features_check/error.rs
@@ -0,0 +1 @@
"serde_json doesn't work without `alloc` or default `std` feature yet"
13 changes: 13 additions & 0 deletions src/features_check/mod.rs
@@ -0,0 +1,13 @@
//! Shows a user-friendly compiler error on incompatible selected features.

#[allow(unused_macros)]
macro_rules! hide_from_rustfmt {
($mod:item) => {
$mod
};
}

#[cfg(all(not(feature = "std"), not(feature = "alloc")))]
hide_from_rustfmt! {

This comment has been minimized.

Copy link
@luojia65

luojia65 May 14, 2020

Could this part be #[rustfmt::skip]?

mod error;
}
2 changes: 2 additions & 0 deletions src/lib.rs
Expand Up @@ -432,6 +432,8 @@ pub mod map;
pub mod ser;
pub mod value;

mod features_check;

mod io;
mod iter;
mod number;
Expand Down

0 comments on commit 7852d2f

Please sign in to comment.