Skip to content

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

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
huonw opened this issue Dec 10, 2014 · 1 comment · Fixed by #20263
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-lifetimes Area: Lifetimes / regions

Comments

@huonw
Copy link
Member

huonw commented Dec 10, 2014

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.

@huonw huonw added A-diagnostics Area: Messages for errors, warnings, and lints A-lifetimes Area: Lifetimes / regions labels Dec 10, 2014
@crhino
Copy link
Contributor

crhino commented Dec 24, 2014

This seems like a nice and easy issue to start off with and see the inner workings of the rust compiler. I'll take a look.

crhino added a commit to crhino/rust that referenced this issue Dec 29, 2014
alexcrichton added a commit to alexcrichton/rust that referenced this issue Dec 30, 2014
Fixes rust-lang#19707.

In terms of output, it currently uses the form `argument #1`, `argument #2`, etc. If anyone has any better suggestions I would be glad to consider them.
lnicola pushed a commit to lnicola/rust that referenced this issue May 20, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-lifetimes Area: Lifetimes / regions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants