Encountered invalid memory reference while removing nodes
The Rust Programming Language Forum
Encountered invalid memory reference while removing nodes
#[derive(Debug)] struct Node<T> { data: T, next: Mutex<*mut Node<T>>, } #[derive(Debug)] pub struct List<T> { head: Mutex<*mut Node<T>>, } every node in this List is Box::into_rawed. I encountered an invalid memory reference error message while concurrently calling this function. fn remove(&self, key: &T) -> bool { let mut head = &self.head; if !self.contains(key) { return false; } while let Ok(mut guard) = head.lock() { ...
0 comments
No comments yet.