Merged
Conversation
2557457 to
dcc339b
Compare
joshlf
requested changes
Nov 27, 2023
b500286 to
8d0ddf7
Compare
joshlf
requested changes
Nov 27, 2023
Member
There was a problem hiding this comment.
Need to add tests, notably:
- In
src/lib.rs, the impl tests for types likeUnalignshould test with both sized and unsized types - UI failure tests for the following cases:
- Type is
repr(C), trailing field is a concrete type (not a type parameter), and trailing field doesn't implementKnownLayout - Type is not
repr(C), trailing field is a concrete type (not a type parameter), and trailing field is unsized
- Type is
- Non-UI tests for all combinations of the following axes:
-
repr(C)/notrepr(C) - Trailing field is concrete/generic
- Trailing field does/does not implement
KnownLayout - Trailing field is sized/unsized
-
5345efa to
af44c49
Compare
joshlf
requested changes
Nov 27, 2023
Member
joshlf
left a comment
There was a problem hiding this comment.
For success cases, can we also test that we get the expected value for KnownLayout::LAYOUT?
It's probably also worth adding a test along these lines:
#[repr(C)]
struct Foo<A, B, C>(A, B, C);
macro_rules! test_foo {
($a:ty, $b:ty, $c:ty => $layout:expr) => {
assert_eq!(<Foo<$a, $b, $c> as KnownLayout>::LAYOUT, $layout);
};
}
// TODO: A bunch of different combinations of types with different sizes and alignments233aa78 to
786a279
Compare
joshlf
requested changes
Nov 28, 2023
Comment on lines
+5165
to
+5409
| struct NotKnownLayout<T = ()> { | ||
| _t: T, | ||
| } |
Collaborator
Author
There was a problem hiding this comment.
Discussed offline: It could use a repr(transparent), but it would be sufficiently interesting if this test started failing on a future Rust version, that it'd be nice to get the heads up.
ab87b85 to
8b28748
Compare
DSTs must be marked with `repr(C)`. The expansion requires the final field implement `KnownLayout`. Makes progress towards #29.
8b28748 to
fb70716
Compare
joshlf
approved these changes
Nov 29, 2023
35 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 towards #29. Supersedes #541.
For types marked
#[repr(C)], this derive requires that the trailing field isKnownLayout:For non-
repr(C)layouts, it's only required thatSelf: Sized.