Description
#73 switched to a newer version of the alloc API, but not the final stabilized version after the changes in rust-lang/rust#51241. It also didn't update any of the earlier code in the chapter (which still uses heap::reallocate
, etc), so now the chapter is inconsistent and confusing to the reader when vec-final.md
isn't composed of all the code they've been shown step-by-step so far.
A lot of the explanatory text also seems dated:
Because all the best tools for writing unsafe code are unstable, this project will only work on nightly (as of Rust 1.9.0). With the exception of the allocator API, much of the unstable code we'll use is expected to be stabilized in a similar form as it is today.
Unfortunately the mechanism for stating that your value is non-zero is unstable and unlikely to be stabilized soon. As such we're just going to take the hit and use std's Unique: