fitzgen / bumpalo

A fast bump allocation arena for Rust
https://docs.rs/bumpalo
Apache License 2.0
1.36k stars 111 forks source link

Add `iter_allocated_chunks_unchecked()` #126

Closed poconn closed 2 years ago

poconn commented 2 years ago

Fixes #121

As per discussion in the issue, we want (unsafe) iteration over an arena's chunks without a mutable borrow of self.

Thanks!

poconn commented 2 years ago

Just noticed this part of @fitzgen's comment on the issue which I missed earlier:

iter_allocated_chunks gives our shared references to the underlying chunks which, if we allowed &self on iter_allocated_chunks, could have active exclusive references from allocated things

Need to mention that in the doc also, will post a revision.

poconn commented 2 years ago

Sure, makes a lot of sense, thanks! Posted a new PR: https://github.com/fitzgen/bumpalo/pull/127