1 mod drop; 2 3 use self::drop::{DetectDrop, Flag}; 4 use anyhow::Error; 5 use std::marker::Unpin; 6 use std::mem; 7 8 #[test] test_error_size()9fn test_error_size() { 10 assert_eq!(mem::size_of::<Error>(), mem::size_of::<usize>()); 11 } 12 13 #[test] test_null_pointer_optimization()14fn test_null_pointer_optimization() { 15 assert_eq!(mem::size_of::<Result<(), Error>>(), mem::size_of::<usize>()); 16 } 17 18 #[test] test_autotraits()19fn test_autotraits() { 20 fn assert<E: Unpin + Send + Sync + 'static>() {} 21 assert::<Error>(); 22 } 23 24 #[test] test_drop()25fn test_drop() { 26 let has_dropped = Flag::new(); 27 drop(Error::new(DetectDrop::new(&has_dropped))); 28 assert!(has_dropped.get()); 29 } 30