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

Less ZeroMap mutation in datagen #3098

Merged
merged 3 commits into from
Feb 9, 2023

Conversation

robertbastian
Copy link
Member

Construct all ZeroMaps using FromIterator and BTreeMaps. This reduces the issue in #2826 to ZeroMap's FromIterator.

Manishearth
Manishearth previously approved these changes Feb 9, 2023
@@ -405,6 +405,18 @@ impl<'a, T: VarULE + ?Sized, F: VarZeroVecFormat> VarZeroVec<'a, T, F> {
}
}

impl<A, T, F> From<Vec<A>> for VarZeroVec<'static, T, F>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if we want an impliclty discarding conversion but i guess it's fine since From is known to be moving

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1; prefer to not have the implicit moving conversion; where is it used? Seems better to change the call sites from myvec.into() to (&myvec).into() which is more explicit

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, it's converting a Vec<T> into a VarZeroVec<T>, so no elements are discarded. Just because we don't move out of the Vec doesn't mean we cannot offer this API for ergonomics as well. But reverted.

sffc
sffc previously approved these changes Feb 9, 2023
@robertbastian robertbastian merged commit c6c67a1 into unicode-org:main Feb 9, 2023
@robertbastian robertbastian deleted the dgmaps branch February 9, 2023 19:21
Copy link
Member

@sffc sffc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(lgtm)

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 this pull request may close these issues.

3 participants