Closed zxch3n closed 1 year ago
I encounter BAD ACCESS when using a struct that has this structure. When dropping, it will try to access a freed footer pointer of the RawVec, which causes BAD ACCESS.
Do you have a reproducible example?
If this struct should not be allowed, I think it's better to mention it in the doc.
A program that doesn't use unsafe
shouldn't be able to cause UB, no matter what the docs say. A bug should be fixed and not be documented.
Sorry, it turns out is a bug on my side.
Would a recursive type looks like this cause undefined behavior when dropping?
BumpBox<'a, BumpVec<'a, BumpBox<'a, ...>>>
I encounter BAD ACCESS when using a struct that has this structure. When dropping, it will try to access a freed footer pointer of the RawVec, which causes BAD ACCESS.
https://github.com/fitzgen/bumpalo/blob/f551c3765f3b366c8cbf7dd2466d0917114b906b/src/collections/raw_vec.rs#L659
It works fine after switching to
&'a mut BumpVec
.If this struct should not be allowed, I think it's better to mention it in the doc.