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

Closed
jswrenn opened this issue May 2, 2024 · 1 comment
Closed

Generalize Ptr invariant relaxation #1167

jswrenn opened this issue May 2, 2024 · 1 comment

Comments

@jswrenn
Copy link
Collaborator

jswrenn commented May 2, 2024

WARNING: This might be unsound per #1866.

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).

@joshlf
Copy link
Member

joshlf commented Oct 14, 2024

Closing in favor of #1866, which goes in a different direction.

@joshlf joshlf closed this as not planned Won't fix, can't repro, duplicate, stale Oct 14, 2024
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

2 participants