Skip to content

wishlist: Way to express Fn trait like (FnOnce() -> !) #1120

@pnkfelix

Description

@pnkfelix

Spawned off of rust-lang/rust#25325

As written by @diwic originally:

Here's a minimal example that shows the problem:

    fn never_return<F: FnOnce() -> !>(f: F) -> ! {
        f();
    }

which fails with:

    error: expected type, found `!`
         fn never_return<F: FnOnce() -> !>(f: F) -> ! {

...AFAICS, there's no good reason this syntax is not allowed.

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