-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tests fail when run with miri #15
Comments
Here's a simpler test case: let mut m = LinkedList::new();
m.push_back(2);
m.push_back(3);
assert_eq!(m.pop_front(), Some(2)); which fails with:
|
A further simplification: let ptr: *mut Node<_>;
let mut head;
{
let mut node = Box::new(Node::new(2));
// unconditionally make the new node the new tail
ptr = &mut *node;
head = Some(node);
}
{
let mut node = Box::new(Node::new(3));
let tail = unsafe { &mut *(ptr as *mut Node<_>) };
node.prev = Raw::some(tail);
tail.next = Some(node);
}
head.take(); |
And here's the essence of what's going on: let mut node = Box::new(Node::new(2));
let mut n2 = Box::new(Node::new(3));
let ptr: *mut Node<_> = &mut *node;
let tail = unsafe { &mut *(ptr as *mut Node<_>) };
let mut head = Some(node);
tail.next = Some(n2); If we swap the order of It's not clear to me why miri's is complaining about this:
|
Can you make this into a self-contained example for the playground? That'd make analysis much easier for me. |
Yep. Will do. |
|
It seems like the use of Box in this crate basically needs to go. It looks like this happened in std's LinkedList in rust-lang/rust#34608 |
The text was updated successfully, but these errors were encountered: