Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inconsistent, outdated Vec chapter #83

Closed
isonmad opened this issue Aug 12, 2018 · 4 comments · Fixed by #223
Closed

inconsistent, outdated Vec chapter #83

isonmad opened this issue Aug 12, 2018 · 4 comments · Fixed by #223

Comments

@isonmad
Copy link

isonmad commented Aug 12, 2018

#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:

@Askaholic
Copy link

Looks like std::ptr::Unique has also been deprecated in favor of std::ptr::NonNull. So the Vec chapter should be reworked to use that as well.

See: rust-lang/rust#49858

@rvql
Copy link

rvql commented Mar 1, 2019

any plans on this issue?

@Coder-256
Copy link

The Vec example in the PhantomData chapter also needs to be rewritten... as does (dare I say) RawVec itself

@skade
Copy link
Contributor

skade commented Feb 21, 2020

Currently, the example by the end of the chapter compiles, but the changes haven't been pulled into the text.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants