Skip to content

In core::ptr, weird thing about impl<T: ?Sized> #24794

Closed

Description

So the implementation itself is for T: ?Sized, but the actual functions themselves are for T: Sized.

i.e.

#[lang = "const_ptr"]
impl<T: ?Sized> *const T {
    #[inline]
    pub fn is_null(self) -> bool where T: Sized {
        self == 0 as *const T
    }
}

This makes absolutely no sense. First: why would you impl<T: ?Sized> and then not allow you to call any functions on T: !Sized. Second, why can you only call is_null on T: Sized? Makes absolutely no sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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