the following code causes a segmentation fault when executed
using git version of intrusive-collections
use intrusive_collections::{intrusive_adapter, LinkedListLink, LinkedList};
struct Value<T> {
link: LinkedListLink,
value: T,
}
intrusive_adapter!(BoxedValueAdapter<T> = Box<Value<T>>: Value<T> { link: LinkedListLink });
fn main() {
let mut list = LinkedList::new(BoxedValueAdapter::new());
for x in 0..10 {
let c = Value {
link: LinkedListLink::new(),
value: x,
};
list.push_back(Box::new(c));
}
let mut curs = list.back_mut();
for _ in 0..2 {
curs.move_next();
}
let rest = curs.split_before();
let mut curs = list.back_mut();
curs.splice_after(rest);
for x in &list {
println!("{}", x.value);
}
}
this is the output from running cargo miri with the same code
error[E0080]: Miri evaluation error: type validation failed: encountered 0, but expected something greater or equal to 1
--> /home/user/.cargo/git/checkouts/intrusive-rs-9ecae677e4651113/e8a03c3/src/linked_list.rs:124:9
|
124 | (*self.0).next.set(next);
| ^^^^^^^^^^^^^^ Miri evaluation error: type validation failed: encountered 0, but expected something greater or equal to 1
|
= note: inside call to `intrusive_collections::linked_list::NodePtr::set_next` at /home/user/.cargo/git/checkouts/intrusive-rs-9ecae677e4651113/e8a03c3/src/linked_list.rs:186:9
= note: inside call to `intrusive_collections::linked_list::NodePtr::splice` at /home/user/.cargo/git/checkouts/intrusive-rs-9ecae677e4651113/e8a03c3/src/linked_list.rs:504:21
note: inside call to `intrusive_collections::linked_list::CursorMut::<BoxedValueAdapter<i32>>::splice_after` at src/main.rs:27:5
--> src/main.rs:27:5
|
27 | curs.splice_after(rest);
| ^^^^^^^^^^^^^^^^^^^^^^^
the following code causes a segmentation fault when executed using git version of intrusive-collections
this is the output from running cargo miri with the same code
rustc version