Skip to content

Multiple input lifetimes when attempting elision in fn & unboxed closure type signatures gives imprecise help #19707

Closed
@huonw

Description

@huonw
type foo = fn(&u8, &u8) -> &u8;

fn main() {}
bad-error.rs:1:28: 1:31 error: missing lifetime specifier [E0106]
bad-error.rs:1 type foo = fn(&u8, &u8) -> &u8;
                                          ^~~
bad-error.rs:1:28: 1:31 help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `` or ``
bad-error.rs:1 type foo = fn(&u8, &u8) -> &u8;
                                          ^~~
error: aborting due to previous error

The empty `'d things would preferably be "first argument" and "second argument" (or something) respectively, rather than just empty strings.

A fix for this should consider/test unboxed closure function traits Fn(&u8, &u8) -> &u8 which does the same sort of lifetime elision.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-lifetimesArea: Lifetimes / regions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions