fn test_01() {
let mut ans = im::Vector::new();
for i in 0..10_000 {
ans.push_back(1);}
ans.push_back(2);
for i in 0..10_000 {
ans.push_back(1);}
ans.sort_by(|lhs, rhs| lhs.cmp(rhs));}
Yes, it stack overflows for me as well. My guess is that this is because the destructor ends up recursing 10000 times. See this post for a similar situation with linked lists.
Also, please rustfmt your code before you post it.