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
KnownLayout tracks pointer metadata type #995
Conversation
9c18f87
to
304f572
Compare
304f572
to
b730441
Compare
b730441
to
ef75344
Compare
abe69ee
to
ef40641
Compare
ef40641
to
fe63e38
Compare
/// `()` for sized types and `usize` for slice DSTs. | ||
#[doc(hidden)] | ||
type PointerMetadata: PointerMetadata; |
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.
Might want to remove the doc(hidden)
here once this appears in where
bounds.
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.
Done in the next PR.
src/lib.rs
Outdated
/// What is the size of the object with the given layout and pointer | ||
/// metadata? |
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.
/// What is the size of the object with the given layout and pointer | |
/// metadata? | |
/// Computes the size of the object with the given layout and pointer | |
/// metadata. |
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.
Done.
src/lib.rs
Outdated
fn size_for_metadata(&self, layout: DstLayout) -> Option<usize> { | ||
match layout.size_info { | ||
SizeInfo::Sized { size } => Some(size), | ||
SizeInfo::SliceDst(_) => unreachable!(), |
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.
In the interest of minimizing our panic paths, perhaps we should do something besides unreachable!()
, like return None
.
(We can't use unreachable_unchecked()
, because this method is safe and this line is obviously not actually unreachable when evaluated in isolation.)
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.
Done.
Makes progress on #29
fe63e38
to
435feb4
Compare
Makes progress on #29