The problem is not if it has drop, the problem that you have is ther order, of the expressions
fn main() {
let s246 = BTreeSet::from([2, 4, 6];
//if you put the expression here it worked
let s12345: BTreeSet< i32> = BTreeSet::from_iter(1..=5);
let s23456 = BTreeSet::from_iter(2..=6);
let mut iter = s246.difference(&s23456);
assert_eq!(iter.size_hint(), (0, Some(3)));
assert_eq!(iter.next(), None);
I think you have misunderstood my problem. pstd is meant to be compatible with std, but the example program didn't compile without changes. It turned out this was because pstd::collections::btree_set::Difference had a destructor (which never in fact did anything), and the solution was to re-write pstd to eliminate the destructor. The test program now compiles without error with the latest version of pstd.
I understand the problem better, so
pub fn difference<'a>(&'a self, other: &'a BTreeSet<T, A>) -> Difference<'a, T, A>
i think the problem is that when you drop iter, the compiler know that self and other can be dropped too, this is non true for this, but it be for others examples. all that because all tree have the same life time