-
Notifications
You must be signed in to change notification settings - Fork 174
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
Crabbake for utils #1926
Conversation
For FFI we seem to have pinned |
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 |
If you can't, see if it's easy to update to a newer llvm, both on your glinux system and on CI. |
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. |
There was a problem hiding this 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/map/map.rs
Outdated
@@ -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 { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
Notice: the branch changed across the force-push!
~ Your Friendly Jira-GitHub PR Checker Bot |
@@ -6,6 +6,9 @@ | |||
|
|||
mod borrowed; | |||
pub(crate) mod map; | |||
|
|||
#[cfg(feature = "crabbake")] | |||
mod crabbake; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
utils/zerovec/src/zerovec/mod.rs
Outdated
/// # Safety | ||
/// | ||
/// `bytes` need to be an output from [`ZeroSlice::as_bytes()`], and `size_of` | ||
/// is `mem::size_of::<T::ULE>()`. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch @Manishearth !
No description provided.