Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Adjust Vec to build on stable Rust #223
Adjust Vec to build on stable Rust #223
Changes from 1 commit
83e4153
0e33cf6
d918366
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At some point I really want to implement rust-lang/rust#77974.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that the above is only true if LLVM can prove that the loop is finite. This is true in the case of
Vec
, but for example LLVM has no way to know that a linked list has no cycles.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. And based on the docs for needs_drop it sounds like even in the
Vec
case LLVM might not eliminate the loop in debug builds. In any case, it is probably fragile to rely on LLVM for this behavior. I'm thinking of a few options for how we could address this:mem::needs_drop
to skip the loop ifT
is!Drop
.ptr::drop_in_place
(which is what the standard libraryVec
does).I would lean toward option 4, since currently this section is very short and could benefit from more discussion and examples to illustrate the usage of
mem::needs_drop
andptr::drop_in_place
. If we go with 2, 3, or 4, it will also require changes tovec-raw.md
andvec-final.md
for consistency. If you don't mind, do you think I could create a separate PR for this change, since it addresses a separate issue from the current PR?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that option 4 sounds like the best way to go. It's fine to do this in a separate PR.