Skip to content

lifetime elision should apply to closure types #18637

Description

@comex
fn help(f: fn(a: &int, b: &int) -> int) {} // OK
fn help2<F: Fn(&int, &int) -> int>(f: F) {} // error

->

hhh.rs:3:16: 3:20 error: missing lifetime specifier [E0106]
hhh.rs:3 fn help2<F: Fn(&int, &int) -> int>(f: F) {}
                        ^~~~
hhh.rs:3:22: 3:26 error: missing lifetime specifier [E0106]
hhh.rs:3 fn help2<F: Fn(&int, &int) -> int>(f: F) {}
                              ^~~~

It seems like it can't possibly be right that this would work for one but not the other.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions