mirror of
https://github.com/getzola/zola
synced 2024-11-10 06:14:19 +00:00
Fixed unsound errors (#1143)
This commit is contained in:
parent
51a2213fcf
commit
af0dd5ef32
3 changed files with 11 additions and 14 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -2307,9 +2307,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "syntect"
|
||||
version = "4.3.0"
|
||||
version = "4.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b57a45fdcf4891bc79f635be5c559210a4cfa464891f969724944c713282eedb"
|
||||
checksum = "4e3978df05b5850c839a6b352d3c35ce0478944a4be689be826b53cf75363e88"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"bitflags",
|
||||
|
|
|
@ -8,4 +8,4 @@ edition = "2018"
|
|||
tera = "1"
|
||||
toml = "0.5"
|
||||
image = "0.23"
|
||||
syntect = "4.1"
|
||||
syntect = "4.4"
|
||||
|
|
|
@ -17,21 +17,18 @@ pub enum ErrorKind {
|
|||
pub struct Error {
|
||||
/// Kind of error
|
||||
pub kind: ErrorKind,
|
||||
pub source: Option<Box<dyn StdError>>,
|
||||
pub source: Option<Box<dyn StdError + Send + Sync>>,
|
||||
}
|
||||
unsafe impl Sync for Error {}
|
||||
unsafe impl Send for Error {}
|
||||
|
||||
impl StdError for Error {
|
||||
fn source(&self) -> Option<&(dyn StdError + 'static)> {
|
||||
let mut source = self.source.as_ref().map(|c| &**c);
|
||||
if source.is_none() {
|
||||
if let ErrorKind::Tera(ref err) = self.kind {
|
||||
source = err.source();
|
||||
}
|
||||
match self.source {
|
||||
Some(ref err) => Some(&**err),
|
||||
None => match self.kind {
|
||||
ErrorKind::Tera(ref err) => err.source(),
|
||||
_ => None,
|
||||
},
|
||||
}
|
||||
|
||||
source
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,7 +52,7 @@ impl Error {
|
|||
}
|
||||
|
||||
/// Creates generic error with a cause
|
||||
pub fn chain(value: impl ToString, source: impl Into<Box<dyn StdError>>) -> Self {
|
||||
pub fn chain(value: impl ToString, source: impl Into<Box<dyn StdError + Send + Sync>>) -> Self {
|
||||
Self { kind: ErrorKind::Msg(value.to_string()), source: Some(source.into()) }
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue