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

Generalize Ptr invariant relaxation #1167

Open
jswrenn opened this issue May 2, 2024 · 0 comments
Open

Generalize Ptr invariant relaxation #1167

jswrenn opened this issue May 2, 2024 · 0 comments

Comments

@jswrenn
Copy link
Collaborator

jswrenn commented May 2, 2024

This builds on machinery introduced in #1166.

It would be nice to introduce a general invariant relaxation method in the form:

fn relax_invariants<J>(self) -> Ptr<'a, T, J>
where
    I: invariants::AtLeast<J>,
{
    // SAFETY: `I` is at least as restrictive as `J`.
    unsafe { Ptr::from_ptr(self) }
}

...and call it in our specific .forget_* methods.

We think this might be blocked on stabilizing feature(marker_trait_attr) (rust-lang/rust#29864).

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

No branches or pull requests

1 participant