]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0688.md
Do not suggest using a const parameter when there are bounds on an unused type parameter
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0688.md
1 In-band lifetimes were mixed with explicit lifetime binders.
2
3 Erroneous code example:
4
5 ```compile_fail,E0688
6 #![feature(in_band_lifetimes)]
7
8 fn foo<'a>(x: &'a u32, y: &'b u32) {}   // error!
9
10 struct Foo<'a> { x: &'a u32 }
11
12 impl Foo<'a> {
13     fn bar<'b>(x: &'a u32, y: &'b u32, z: &'c u32) {}   // error!
14 }
15
16 impl<'b> Foo<'a> {  // error!
17     fn baz() {}
18 }
19 ```
20
21 In-band lifetimes cannot be mixed with explicit lifetime binders.
22 For example:
23
24 ```
25 fn foo<'a, 'b>(x: &'a u32, y: &'b u32) {}   // ok!
26
27 struct Foo<'a> { x: &'a u32 }
28
29 impl<'a> Foo<'a> {
30     fn bar<'b,'c>(x: &'a u32, y: &'b u32, z: &'c u32) {}    // ok!
31 }
32
33 impl<'a> Foo<'a> {  // ok!
34     fn baz() {}
35 }
36 ```