diff --git a/src/tools/lru_cache.rs b/src/tools/lru_cache.rs index 34b4c7ac..745c5ab8 100644 --- a/src/tools/lru_cache.rs +++ b/src/tools/lru_cache.rs @@ -5,6 +5,7 @@ //! is used to keep track of the cache access order. use std::collections::HashMap; +use std::marker::PhantomData; /// Interface for getting values on cache misses. pub trait Cacher { @@ -24,6 +25,8 @@ struct CacheNode { value: V, prev: *mut CacheNode, next: *mut CacheNode, + // Dropcheck marker. See the phantom-data section in the rustonomicon. + _marker: PhantomData>>, } impl CacheNode { @@ -33,6 +36,7 @@ impl CacheNode { value, prev: std::ptr::null_mut(), next: std::ptr::null_mut(), + _marker: PhantomData, } } } @@ -89,6 +93,8 @@ pub struct LruCache { head: *mut CacheNode, tail: *mut CacheNode, capacity: usize, + // Dropcheck marker. See the phantom-data section in the rustonomicon. + _marker: PhantomData>>, } impl LruCache { @@ -99,6 +105,7 @@ impl LruCache { head: std::ptr::null_mut(), tail: std::ptr::null_mut(), capacity, + _marker: PhantomData, } }