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

Crabbake for utils #1926

Merged
merged 11 commits into from
May 24, 2022
Merged

Crabbake for utils #1926

merged 11 commits into from
May 24, 2022

Conversation

robertbastian
Copy link
Member

No description provided.

@robertbastian robertbastian requested review from Manishearth, sffc and a team as code owners May 22, 2022 10:03
@robertbastian
Copy link
Member Author

For FFI we seem to have pinned nightly-2022-01-31, I don't know what the reasoning behind that is and what to update that to.

@Manishearth
Copy link
Member

some ffi tests need a compatible llvm, which is not always easy to install for newer rusts. If you can make it work without changing the clang version in the makefiles that should be fine

@Manishearth
Copy link
Member

If you can't, see if it's easy to update to a newer llvm, both on your glinux system and on CI.

@sffc
Copy link
Member

sffc commented May 22, 2022

As long as all of CI passes, we're fine to update the nightly version. The test that requires compatible LLVM runs on CI now.

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.

Praise: Thanks for doing this and glad that it appears to work! And thanks for making it a smaller self contained PR

I have some comments for discussion, but otherwise this is LGTM

utils/zerovec/src/varzerovec/vec.rs Outdated Show resolved Hide resolved
@@ -98,6 +98,12 @@ where
values: V::Container::zvl_new(),
}
}

#[doc(hidden)] // Crabbake internal
pub fn from_parts_unchecked(keys: K::Container, values: V::Container) -> Self {
Copy link
Member

Choose a reason for hiding this comment

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

Discussion: are this and similar constructors better as doc-hidden, doc-hidden unsafe, or pub unsafe?

Copy link
Member

Choose a reason for hiding this comment

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

I don't think they should be doc-hidden, we shouldn't be special casing CrabBake too much. This one doesn't need to be unsafe but I'm not against making it unsafe anyway.

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 made this doc-hidden because it exposes implementation details. The "parts" it refers to might change in the future.

Copy link
Member

Choose a reason for hiding this comment

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

oh, that's a fair point i guess. It's unlikely, but makes sense

Copy link
Member

Choose a reason for hiding this comment

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

How about between safe hidden and unsafe hidden?

I lean toward making these internal constructors unsafe because (1) there are invariants that need to be upheld, (2) people can't accidentally use the functions in an unsafe way, and (3) I see no compelling reason that the methods should not be unsafe

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh whoops I meant to make them doc-hidden unsafe.

utils/codepointtrie/src/codepointtrie.rs Show resolved Hide resolved
@sffc sffc changed the title Crabbake for utils Update to Rust 1.61 and add Crabbake for utils May 22, 2022
rust-toolchain Outdated Show resolved Hide resolved
@jira-pull-request-webhook
Copy link

Notice: the branch changed across the force-push!

  • rust-toolchain is different
  • utils/yoke/src/yoke.rs is now changed in the branch

View Diff Across Force-Push

~ Your Friendly Jira-GitHub PR Checker Bot

@robertbastian robertbastian changed the title Update to Rust 1.61 and add Crabbake for utils Crabbake for utils May 23, 2022
@robertbastian robertbastian requested a review from sffc May 23, 2022 23:31
sffc
sffc previously approved these changes May 24, 2022
Manishearth
Manishearth previously approved these changes May 24, 2022
@@ -6,6 +6,9 @@

mod borrowed;
pub(crate) mod map;

#[cfg(feature = "crabbake")]
mod crabbake;
Copy link
Member

Choose a reason for hiding this comment

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

suggestion(nb): i'd be okay with all the zerovec types having crabbake impls in one file, the way we do for yoke. either works.

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've been following serde because I think that's a better metaphor than yoke.

/// # Safety
///
/// `bytes` need to be an output from [`ZeroSlice::as_bytes()`], and `size_of`
/// is `mem::size_of::<T::ULE>()`.
Copy link
Member

Choose a reason for hiding this comment

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

issue: are we not allowed to do that in const yet? bummer.

Copy link
Member

Choose a reason for hiding this comment

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

size_of appears to be const?

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 thought we couldn't but we can!

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I knew the assoc type was a problem in the past but i figured it wouldn't be anymore!

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.

Good catch @Manishearth !

@robertbastian robertbastian merged commit f6ffb44 into unicode-org:main May 24, 2022
@robertbastian robertbastian deleted the crutils branch May 24, 2022 18:55
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