Skip to content

Commit b86f2d6

Browse files
committed
Make XmlError be Send and Sync
1 parent 1390d5c commit b86f2d6

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased
44

5+
- Fix a regression: make `Error` and `XmlError` be `Send` and `Sync` again [`#89`](https://github.com/rust-syndication/atom/pull/89)
6+
57
## 0.12.5 - 2024-11-16
68

79
- Remove ambiguous statements about escaping from documentation. [`#85`](https://github.com/rust-syndication/atom/pull/85)

src/error.rs

+14-2
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ impl From<XmlError> for Error {
6464
}
6565

6666
#[derive(Debug)]
67-
pub struct XmlError(Box<dyn StdError>);
67+
pub struct XmlError(Box<dyn StdError + Send + Sync>);
6868

6969
impl XmlError {
70-
pub(crate) fn new(err: impl StdError + 'static) -> Self {
70+
pub(crate) fn new(err: impl StdError + Send + Sync + 'static) -> Self {
7171
Self(Box::new(err))
7272
}
7373
}
@@ -83,3 +83,15 @@ impl fmt::Display for XmlError {
8383
fmt::Display::fmt(&self.0, f)
8484
}
8585
}
86+
87+
#[cfg(test)]
88+
mod test {
89+
use super::*;
90+
91+
#[test]
92+
fn error_send_and_sync() {
93+
fn assert_send_sync<T: Send + Sync>() {}
94+
assert_send_sync::<Error>();
95+
assert_send_sync::<XmlError>();
96+
}
97+
}

0 commit comments

Comments
 (0)