Skip to content

Commit 6b6217c

Browse files
committed
Add a test for the size of the Node type
1 parent 3f6b678 commit 6b6217c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ struct Node<T> {
6060
value: T,
6161
}
6262

63+
fn _static_assert_size_of_node() {
64+
// "Instanciating" the generic `transmute` function without calling it
65+
// still triggers the magic compile-time check
66+
// that input and output types have the same `size_of()`.
67+
let _ = std::mem::transmute::<Node<()>, [usize; 9]>;
68+
}
69+
6370
impl<T> Node<T> {
6471
fn new(value: T) -> Self {
6572
Node {

0 commit comments

Comments
 (0)