Skip to content

Commit 9ffd8c4

Browse files
committed
Tests to ensure common and auto trait presence
1 parent cf9e29e commit 9ffd8c4

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ serde = { version = "1.0", optional = true, default_features = false }
1717

1818
[dev-dependencies]
1919
serde_test = "1.0"
20+
static_assertions = "1.1"
2021

2122
[[test]]
2223
name = "serde"

tests/auto_traits.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
use {
2+
static_assertions::*,
3+
std::{
4+
fmt::Debug,
5+
hash::Hash,
6+
marker::{Send, Sync},
7+
panic::{RefUnwindSafe, UnwindSafe},
8+
},
9+
text_size::*,
10+
};
11+
12+
// auto traits
13+
assert_impl_all!(TextSize: Send, Sync, Unpin, UnwindSafe, RefUnwindSafe);
14+
assert_impl_all!(TextRange: Send, Sync, Unpin, UnwindSafe, RefUnwindSafe);
15+
16+
// common traits
17+
assert_impl_all!(TextSize: Copy, Debug, Default, Hash, Ord);
18+
assert_impl_all!(TextRange: Copy, Debug, Default, Hash, Eq);

0 commit comments

Comments
 (0)