Closed
Description
The following code:
struct A; struct B;
let id : &Fn(B)->B = &|x|{x};
let di : &Fn(A)->&Fn(B)->B = &|discard:A|{id};
produces the following error message, which is utterly non-informative about how to fix the problem:
<anon>:14:76: 14:85 error: missing lifetime specifier [E0106]
<anon>:14 struct A; struct B; let id : &Fn(B)->B = &|x|{x}; let di : &Fn(A)->&Fn(B)->B = &|discard:A|{id};
^~~~~~~~~
<anon>:14:76: 14:85 help: this function's return type contains a borrowed value, but the signature does not say which one of argument 1's 0 elided lifetimes it is borrowed from
<anon>:14 struct A; struct B; let id : &Fn(B)->B = &|x|{x}; let di : &Fn(A)->&Fn(B)->B = &|discard:A|{id};
^~~~~~~~~
In particular "which one of argument 1's 0 elided lifetimes it is borrowed from" is particularly confusing.
Version: rustc 1.0.0-dev (2b01a37ec 2015-02-21) (built 2015-02-21)