Skip to content

Generalize Ptr invariant relaxation #1167

Closed as not planned
Closed as not planned
@jswrenn

Description

@jswrenn

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions