Skip to content

Consider using const_panic in the future. #43

@konsumlamm

Description

@konsumlamm

Tracking issue for const_panic: rust-lang/rust#51999.

Once this gets stabilized, it would be allowed to panic in a const context, so macros like const_assert could be implemented like this:

macro_rules! const_assert {
    ($x:expr $(,)?) => {
        const _: () = if $x { () } else { panic!("static assertion failed") };
    };
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions