]> git.proxmox.com Git - rustc.git/blame - compiler/rustc_error_codes/src/error_codes/E0687.md
New upstream version 1.61.0+dfsg1
[rustc.git] / compiler / rustc_error_codes / src / error_codes / E0687.md
CommitLineData
5e7ed085
FG
1#### Note: this error code is no longer emitted by the compiler.
2
f035d41b
XL
3In-band lifetimes cannot be used in `fn`/`Fn` syntax.
4
5Erroneous code examples:
6
5e7ed085 7```ignore (feature got removed)
f035d41b
XL
8#![feature(in_band_lifetimes)]
9
10fn foo(x: fn(&'a u32)) {} // error!
11
12fn bar(x: &Fn(&'a u32)) {} // error!
13
14fn baz(x: fn(&'a u32), y: &'a u32) {} // error!
15
16struct Foo<'a> { x: &'a u32 }
17
18impl Foo<'a> {
19 fn bar(&self, x: fn(&'a u32)) {} // error!
20}
21```
22
23Lifetimes used in `fn` or `Fn` syntax must be explicitly
24declared using `<...>` binders. For example:
25
26```
27fn foo<'a>(x: fn(&'a u32)) {} // ok!
28
29fn bar<'a>(x: &Fn(&'a u32)) {} // ok!
30
31fn baz<'a>(x: fn(&'a u32), y: &'a u32) {} // ok!
32
33struct Foo<'a> { x: &'a u32 }
34
35impl<'a> Foo<'a> {
36 fn bar(&self, x: fn(&'a u32)) {} // ok!
37}
38```