Skip to content

Const null #149

Description

@bakcxoj

It is not possible to do the following.

slotmap::new_key_type! {
    pub struct MyKey;
}

pub const fn null_key() -> MyKey {
    MyKey::null() // Error: cannot call non-const associated function
}

It's not even possible to fake it.

pub const fn null_key() -> MyKey {
    let key_data = KeyData::from_ffi(i32::MAX as u64);
    MyKey::from(key_data) // Error: cannot call non-const associated function
}

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions