Skip to content

Commit

Permalink
Fix unstable build
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mina86 committed Jul 28, 2023
1 parent 7b09ccc commit 2edcc81
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
4 changes: 0 additions & 4 deletions serde/src/de/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,6 @@ mod utf8;

pub use self::ignored_any::IgnoredAny;

#[cfg(feature = "std")]
#[doc(no_inline)]
pub use std::error::Error as StdError;
#[cfg(not(feature = "std"))]
#[doc(no_inline)]
pub use std_error::Error as StdError;

Expand Down
1 change: 0 additions & 1 deletion serde/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,6 @@ use self::__private as private;
#[path = "de/seed.rs"]
mod seed;

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

// Re-export #[derive(Serialize, Deserialize)].
Expand Down
7 changes: 0 additions & 7 deletions serde/src/ser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,6 @@ mod impossible;

pub use self::impossible::Impossible;

#[cfg(all(feature = "unstable", not(feature = "std")))]
#[doc(inline)]
pub use core::error::Error as StdError;
#[cfg(feature = "std")]
#[doc(no_inline)]
pub use std::error::Error as StdError;
#[cfg(not(any(feature = "std", feature = "unstable")))]
#[doc(no_inline)]
pub use std_error::Error as StdError;

Expand Down
11 changes: 9 additions & 2 deletions serde/src/std_error.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
use lib::{Debug, Display};
#[cfg(all(feature = "unstable", not(feature = "std")))]
#[doc(no_inline)]
pub use core::error::Error;

#[cfg(feature = "std")]
#[doc(no_inline)]
pub use std::error::Error;

/// Either a re-export of std::error::Error or a new identical trait, depending
/// on whether Serde's "std" feature is enabled.
Expand Down Expand Up @@ -40,7 +46,8 @@ use lib::{Debug, Display};
/// ```edition2021
/// impl serde::ser::StdError for MySerError {}
/// ```
pub trait Error: Debug + Display {
#[cfg(not(any(feature = "std", feature = "unstable")))]
pub trait Error: crate::lib::Debug + crate::lib::Display {
/// The underlying cause of this error, if any.
fn source(&self) -> Option<&(Error + 'static)> {
None
Expand Down

0 comments on commit 2edcc81

Please sign in to comment.