Conversation
b27e74d to
644f990
Compare
joshlf
commented
Dec 6, 2023
Member
Author
joshlf
left a comment
There was a problem hiding this comment.
TODO: Add tests for the types described in #656 (comment):
Can you expand on a few edge cases here? I'm not totally clear on what "contains" means. Is this
NoCell?struct R<'a> { field: &'a UnsafeCell<u8>, }...and this?
struct ZLA { field: [UnsafeCell<u8>; 0]; }...and this?
struct CPC { field: PhantomData<UnsafeCell<u8>>; }...and this?
trait Trait { type Assoc; } impl<T> Trait for UnsafeCell<T> { type Assoc = T; } struct CAT<T> where T: NoCell { field: <UnsafeCell<T> as Trait>::Assoc, }...and this?
enum Enum { Uninhabited(!, UnsafeCell<u8>), Inhabited(u8), }
jswrenn
reviewed
Dec 6, 2023
Collaborator
jswrenn
left a comment
There was a problem hiding this comment.
For testing (and potentially the derive expansion), you might find this macro nifty:
macro_rules! assert_unfreeze {
($ty:ty) => {
const _: () = {
static _assert_unfreeze: Option<$ty> = None;
};
}
}
assert_unfreeze!(u8); // accepted!
assert_unfreeze!(core::cell::UnsafeCell<u8>); // rejected! compilation error!ea82fcf to
a5cc3f1
Compare
Makes progress on #251
a5cc3f1 to
3234ced
Compare
Member
Author
Didn't end up needing this, but it's very nifty! |
jswrenn
approved these changes
Dec 6, 2023
11 tasks
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Makes progress on #251