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

Resolve safety issues #5

Merged
merged 2 commits into from Dec 9, 2018

Conversation

Projects
None yet
2 participants
@xfix
Contributor

xfix commented Dec 9, 2018

This improves overall usage of lifetimes in a library and resolve issues with unsafety.

Possible questions:

  • What's with the UnsafeCell in region?

    Transmuting &T into &mut T like it was done here is disallowed, period. UnsafeCell is 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 Ranges refactored into a separate structure?

    To ensure thread safety, by handling checks and then insertion with the same lock. See #2.

  • Why is truncate/get_mut accepting &self?

    Because it's safe to do so, due to inner mutability involved.

  • Why is drop_parent test removed?

    As it doesn't compile, due to borrow checker noticing an isssue.

  • Why is Ranges no longer Arc?

    Because it's unnecessary, reference counting is useless here anyways, the lifetimes here are clear enough to not have to bother with it.

Resolve safety issues
This improves overall usage of lifetimes in a library.

@xfix xfix force-pushed the xfix:resolve-safety-issues branch from 85d545c to cc59f8a Dec 9, 2018

@Aaronepower

This comment has been minimized.

Owner

Aaronepower commented Dec 9, 2018

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 Aaronepower merged commit 8e47a4f into Aaronepower:master Dec 9, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment