Closed goffrie closed 1 year ago
These use &'_ self when they should use &'a self (resp. mut).
&'_ self
&'a self
mut
Sample program that segfaults when it shouldn't compile:
//! ```cargo //! [dependencies] //! caches = { version = "0.2" } //! ``` use caches::{Cache, RawLRU}; fn main() { let mut lru = RawLRU::new(2).unwrap(); lru.put(1, "foo".to_string()); lru.put(2, "bar".to_string()); let iter = lru.iter(); drop(lru); println!("{:?}", iter.collect::<Vec<_>>()); }
Actually it's not just RawLRU - all the methods on trait Cache that return references have the same problem.
trait Cache
Hi, thanks for reporting. Fix the lifetime bug in 0.2.6 error.
0.2.6
These use
&'_ self
when they should use&'a self
(resp.mut
).Sample program that segfaults when it shouldn't compile: