This repository was archived by the owner on Jun 28, 2022. It is now read-only.
Cleanup slices, strings, tags, and vecs#44
Merged
Merged
Conversation
This started with enhancing tags, but when I was done I discovered a sigsev which could be triggered even from Rust code. I knew I had screwed up the lifetimes and unsafe code. So, I started working and I kept unravelling more and more. Slice and vec have been split into their own files as lib.rs was getting large. Tags are now optional. Some strings have changed to be Cow<str>. Many From traits were changed to work with &T instead of T because of lifetime issues.
The other string is only borrowed temporarily.
ivoanjo
approved these changes
Apr 4, 2022
ivoanjo
left a comment
Member
There was a problem hiding this comment.
Looks reasonable! Probably worth having some else also give a second run-through to make sure the Rust-fu is tight, but I like it 👍
Co-authored-by: Ivo Anjo <[email protected]>
It ended up being slighly less lines than duplicating the code. Also run cargo format -- a contrib made in the GitHub UI wasn't quite formatted correctly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This started with enhancing tags, but when I was done I discovered a
sigsev which could be triggered even from Rust code. I knew I had
screwed up the lifetimes and unsafe code.
So, I started working and I kept unravelling more and more.
Slice and vec have been split into their own files as lib.rs was
getting large.
Many From traits were changed to work with &T instead of T because of
lifetime issues.
In this PR, some C FFI APIs for tags have been removed. A subsequent PR
will add them back and enhance them. I wanted to keep the PR size to be
somewhat manageable.
Some places using some form of string have changed to use
Cow<'static, str>. This allows you to borrow static strings, and ownall others. When calling from C, the difference is very little because
they should have been copied (probably, was unsafe if not). I believe
these are the changes which actually fixed the crash.