Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upResolve safety issues #5
+88
−102
Conversation
xfix
force-pushed the
xfix:resolve-safety-issues
branch
from
85d545c
to
cc59f8a
Dec 9, 2018
This comment has been minimized.
This comment has been minimized.
|
Thank you for your PR! This is top quality work. You've saved me a bunch of time, and congratulations on your first PR!. |
Aaronepower
merged commit 8e47a4f
into
Aaronepower:master
Dec 9, 2018
1 check passed
continuous-integration/travis-ci/pr
The Travis CI build passed
Details
This was referenced Dec 9, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
xfix commentedDec 9, 2018
•
edited
This improves overall usage of lifetimes in a library and resolve issues with unsafety.
Possible questions:
What's with the
UnsafeCellinregion?Transmuting
&Tinto&mut Tlike it was done here is disallowed, period.UnsafeCellis a way to do it safely. Well, as safely as it gets, the unsafe code guidelines aren't clear whether this is fine. See #4.Why was
Rangesrefactored into a separate structure?To ensure thread safety, by handling checks and then insertion with the same lock. See #2.
Why is
truncate/get_mutaccepting&self?Because it's safe to do so, due to inner mutability involved.
Why is
drop_parenttest removed?As it doesn't compile, due to borrow checker noticing an isssue.
Why is
Rangesno longerArc?Because it's unnecessary, reference counting is useless here anyways, the lifetimes here are clear enough to not have to bother with it.