Skip to content

Commit dd9fb4e

Browse files
committed
Fix unstable build
Before: $ cargo +nightly build --no-default-features --features unstable Compiling serde v1.0.177 (/srv/mpn/serde/serde) error[E0432]: unresolved import `std_error` --> serde/src/de/mod.rs:134:9 134 | pub use std_error::Error as StdError; | ^^^^^^^^^ maybe a missing crate `std_error`? After: $ cargo +nightly build --no-default-features --features unstable Compiling serde v1.0.177 (/srv/mpn/serde/serde) Finished dev [unoptimized] target(s) in 1.28s Note that `unstable` and non-`std` tests are still failing. Issue: serde-rs#812
1 parent 7b09ccc commit dd9fb4e

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

serde/src/de/mod.rs

-4
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,6 @@ mod utf8;
126126

127127
pub use self::ignored_any::IgnoredAny;
128128

129-
#[cfg(feature = "std")]
130-
#[doc(no_inline)]
131-
pub use std::error::Error as StdError;
132-
#[cfg(not(feature = "std"))]
133129
#[doc(no_inline)]
134130
pub use std_error::Error as StdError;
135131

serde/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,6 @@ use self::__private as private;
328328
#[path = "de/seed.rs"]
329329
mod seed;
330330

331-
#[cfg(not(any(feature = "std", feature = "unstable")))]
332331
mod std_error;
333332

334333
// Re-export #[derive(Serialize, Deserialize)].

serde/src/ser/mod.rs

-7
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,6 @@ mod impossible;
115115

116116
pub use self::impossible::Impossible;
117117

118-
#[cfg(all(feature = "unstable", not(feature = "std")))]
119-
#[doc(inline)]
120-
pub use core::error::Error as StdError;
121-
#[cfg(feature = "std")]
122-
#[doc(no_inline)]
123-
pub use std::error::Error as StdError;
124-
#[cfg(not(any(feature = "std", feature = "unstable")))]
125118
#[doc(no_inline)]
126119
pub use std_error::Error as StdError;
127120

serde/src/std_error.rs

+10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1+
#[cfg(not(any(feature = "std", feature = "unstable")))]
12
use lib::{Debug, Display};
23

4+
#[cfg(all(feature = "unstable", not(feature = "std")))]
5+
#[doc(no_inline)]
6+
pub use core::error::Error;
7+
8+
#[cfg(feature = "std")]
9+
#[doc(no_inline)]
10+
pub use std::error::Error;
11+
312
/// Either a re-export of std::error::Error or a new identical trait, depending
413
/// on whether Serde's "std" feature is enabled.
514
///
@@ -40,6 +49,7 @@ use lib::{Debug, Display};
4049
/// ```edition2021
4150
/// impl serde::ser::StdError for MySerError {}
4251
/// ```
52+
#[cfg(not(any(feature = "std", feature = "unstable")))]
4353
pub trait Error: Debug + Display {
4454
/// The underlying cause of this error, if any.
4555
fn source(&self) -> Option<&(Error + 'static)> {

0 commit comments

Comments
 (0)