Skip to content

Commit

Permalink
Merge pull request #83 from RustCrypto/signature/enforce-error-new
Browse files Browse the repository at this point in the history
signature: ensure `Error::new()` is mandatory
  • Loading branch information
tarcieri authored Mar 10, 2020
2 parents 61f1f46 + e011bda commit 2225669
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions signature/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ use std::boxed::Box;
/// [BB'06]: https://en.wikipedia.org/wiki/Daniel_Bleichenbacher
#[derive(Debug, Default)]
pub struct Error {
/// Prevent from being instantiated as `Error {}` when the `std` feature
/// is disabled
_private: (),

/// Source of the error (if applicable).
#[cfg(feature = "std")]
source: Option<Box<dyn std::error::Error + Send + Sync + 'static>>,
Expand All @@ -41,6 +45,7 @@ impl Error {
source: impl Into<Box<dyn std::error::Error + Send + Sync + 'static>>,
) -> Self {
Self {
_private: (),
source: Some(source.into()),
}
}
Expand Down

0 comments on commit 2225669

Please sign in to comment.