Skip to content

Commit c1d9191

Browse files
committed
Add a test for size_of Option<ThreadId>
1 parent 8cf720b commit c1d9191

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/libstd/thread/mod.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -1485,9 +1485,10 @@ fn _assert_sync_and_send() {
14851485
mod tests {
14861486
use super::Builder;
14871487
use crate::any::Any;
1488+
use crate::mem;
14881489
use crate::sync::mpsc::{channel, Sender};
14891490
use crate::result;
1490-
use crate::thread;
1491+
use crate::thread::{self, ThreadId};
14911492
use crate::time::Duration;
14921493
use crate::u32;
14931494

@@ -1717,6 +1718,11 @@ mod tests {
17171718
thread::sleep(Duration::from_millis(2));
17181719
}
17191720

1721+
#[test]
1722+
fn test_size_of_option_thread_id() {
1723+
assert_eq!(mem::size_of::<Option<ThreadId>>(), mem::size_of::<ThreadId>());
1724+
}
1725+
17201726
#[test]
17211727
fn test_thread_id_equal() {
17221728
assert!(thread::current().id() == thread::current().id());

0 commit comments

Comments
 (0)