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

[project] Initial commit #292

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

[project] Initial commit #292

wants to merge 1 commit into from

Conversation

joshlf
Copy link
Member

@joshlf joshlf commented Aug 29, 2023

Makes progress on #196

@joshlf joshlf marked this pull request as draft August 29, 2023 02:46
@joshlf
Copy link
Member Author

joshlf commented Aug 29, 2023

This is basically ready, except there's one outstanding safety doc comment that I can't figure out how to write.

I know the safety reasoning here is pretty convoluted, so I'd love folks to double-check my work and/or suggest ways to simplify or strengthen the arguments. Referring to #196 may help in understanding the design.

cc @kupiakos @jswrenn @djkoloski

src/project.rs Outdated
Comment on lines 109 to 112
/// `Self` must be a `repr(transparent)`, `repr(packed)`, or `repr(C)` struct
/// with a single non-zero-sized field of type `Self::Inner`. `W` must be a
/// `repr(transparent)`, `repr(packed)`, or `repr(C)` struct with a single
/// non-zero field of type `F`.
Copy link
Member Author

Choose a reason for hiding this comment

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

Oops, this is just wrong. E.g., it doesn't apply to MaybeValid<T: AsMaybeUninit> from #279, whose inner field is not T, but T::MaybeUninit.

Copy link
Member Author

Choose a reason for hiding this comment

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

Okay, I think this should be fixed now?

Comment on lines +368 to +384
// TODO(#196): Is there any way to make sure this calls
// `Borrow::borrow` or `BorrowMut::borrow_mut` even if the type has
// an inherent method of the same name?
Copy link
Member Author

Choose a reason for hiding this comment

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

@kupiakos suggested that the following works:

<_ as $borrow_trait>::$borrow_method($c)

Copy link
Member Author

Choose a reason for hiding this comment

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

@kupiakos I wasn't actually able to get this to work on this PR. Did you test with this PR, or just a minimized version?

@joshlf joshlf force-pushed the field-project branch 2 times, most recently from 35847cb to 1bd5834 Compare August 31, 2023 22:57
Makes progress on #196
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.

1 participant