diff --git a/serde/Cargo.toml b/serde/Cargo.toml index fc73f406..4fefb760 100644 --- a/serde/Cargo.toml +++ b/serde/Cargo.toml @@ -32,30 +32,7 @@ features = ["derive", "rc"] [features] default = ["std"] -# Re-export the derive(Serialize, Deserialize) macros. This is intended for -# library crates that provide optional Serde impls behind a Cargo cfg of their -# own. -# -# Mainly this is a workaround for limitations associated with -# rust-lang/cargo#1286 in which a library crate cannot use one "serde" cfg in -# Cargo to enable dependencies on both serde and serde_derive crates. -# -# The recommended way to provide optional Serde support that requires derive is -# as follows. In particular, please do not name your library's Serde feature -# anything other than "serde". -# -# [dependencies] -# serde = { version = "1.0", optional = true, features = ["derive"] } -# -# Within the library, these optional Serde derives would be written like this. -# -# #[cfg(feature = "serde")] -# #[macro_use] -# extern crate serde; -# -# #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] -# struct ... -# +# Provide derive(Serialize, Deserialize) macros. derive = ["serde_derive"] # Provide impls for common standard library types like Vec and HashMap. diff --git a/serde/src/lib.rs b/serde/src/lib.rs index 77200835..86ad25d2 100644 --- a/serde/src/lib.rs +++ b/serde/src/lib.rs @@ -252,40 +252,6 @@ pub mod private; // Re-export #[derive(Serialize, Deserialize)]. // -// This is a workaround for https://github.com/rust-lang/cargo/issues/1286. -// Without this re-export, crates that put Serde derives behind a cfg_attr would -// need to use some silly feature name that depends on both serde and -// serde_derive. -// -// [features] -// serde-impls = ["serde", "serde_derive"] -// -// [dependencies] -// serde = { version = "1.0", optional = true } -// serde_derive = { version = "1.0", optional = true } -// -// # Used like this: -// # #[cfg(feature = "serde-impls")] -// # #[macro_use] -// # extern crate serde_derive; -// # -// # #[cfg_attr(feature = "serde-impls", derive(Serialize, Deserialize))] -// # struct S { /* ... */ } -// -// The re-exported derives allow crates to use "serde" as the name of their -// Serde feature which is more intuitive. -// -// [dependencies] -// serde = { version = "1.0", optional = true, features = ["derive"] } -// -// # Used like this: -// # #[cfg(feature = "serde")] -// # #[macro_use] -// # extern crate serde; -// # -// # #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] -// # struct S { /* ... */ } -// // The reason re-exporting is not enabled by default is that disabling it would // be annoying for crates that provide handwritten impls or data formats. They // would need to disable default features and then explicitly re-enable std.