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

Relax NoCell bound of TryFromBytes::try_from_mut #1017

Closed
wants to merge 1 commit into from

Conversation

jswrenn
Copy link
Collaborator

@jswrenn jswrenn commented Mar 4, 2024

Makes progress towards #5.

Closes #1014.

///
/// `Ptr` requires that:
///
/// > During the lifetime 'a, no live reference or live `Ptr` will exist to this
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/// > During the lifetime 'a, no live reference or live `Ptr` will exist to this
/// > During the lifetime `'a`, no live reference or live `Ptr` will exist to this

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done (this particular doc comment no longer exists).

/// > memory which treats `UnsafeCell`s as existing at different ranges than
/// > they exist in `T`.
///
/// Implementations of this trait must prove that for an aliasing `A`, a cast of
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/// Implementations of this trait must prove that for an aliasing `A`, a cast of
/// Implementations of this trait must prove that, for an aliasing `A`, a cast of

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done (this particular doc comment no longer exists).

///
/// Implementations of this trait must prove that for an aliasing `A`, a cast of
/// `Ptr<T, Aliasing = A>` to `Ptr<U, Aliasing = A>` does not introduce a live
/// reference to `U` with `UnsafeCell`s at different ranges than a live
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/// reference to `U` with `UnsafeCell`s at different ranges than a live
/// reference or `Ptr` to `U` with `UnsafeCell`s at different ranges than a live

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done (this particular doc comment no longer exists).

/// Implementations of this trait must prove that for an aliasing `A`, a cast of
/// `Ptr<T, Aliasing = A>` to `Ptr<U, Aliasing = A>` does not introduce a live
/// reference to `U` with `UnsafeCell`s at different ranges than a live
/// reference to `T`.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/// reference to `T`.
/// reference or `Ptr` to `T`.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done (this particular doc comment no longer exists).

Comment on lines 1119 to 1124
pub(crate) fn try_cast_into<U: 'a + ?Sized + KnownLayout>(
&self,
cast_type: CastType,
) -> Option<(Ptr<'a, U, (I::Aliasing, invariant::Aligned, invariant::Initialized)>, usize)>
where
[u8]: NoCellSafe<U, I::Aliasing>,
Copy link
Member

Choose a reason for hiding this comment

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

Presumably the changed bounds mean we also need to update the internal safety comments in this method body?

Makes progress towards #5.

Closes #1014.

Co-authored-by: Joshua Liebow-Feeser <[email protected]>
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.

None yet

2 participants