Anyway, at first try this was a bit hard to reproduce, I’ll go and look closer at my real world use cases. This code exhibits the null check problem in ZipSlices
playground code, dot / reduced version, relevant function sum
The relevant function is dot. Hit release and then ASM. As you can see from the closure call, the code has to resemble the benchmark where I found the regression, the closure is surely part of it “forgetting” the pointer information. So that was a bit obscure, but I’m still sure it’s a regression. Also, closures happen in my real code too, I have to use some abstractions…
@ker there’s already a nonnull attribute, assume shouldn’t be needed
Edit: Assume helps on this testcase. But the regression is also present in current stable, is that possible?
assert!(!a.as_ptr().is_null()); is an example of a thing that doesn’t optimize out even if a is a slice. It also does not act like an assume.