Skip to content

Commit e3ae4c7

Browse files
committed
Added proper explanation of ErrorCode-E0688
1 parent 20fc02f commit e3ae4c7

File tree

3 files changed

+38
-1
lines changed

3 files changed

+38
-1
lines changed

src/librustc_error_codes/error_codes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ E0668: include_str!("./error_codes/E0668.md"),
380380
E0669: include_str!("./error_codes/E0669.md"),
381381
E0670: include_str!("./error_codes/E0670.md"),
382382
E0671: include_str!("./error_codes/E0671.md"),
383+
E0688: include_str!("./error_codes/E0688.md"),
383384
E0689: include_str!("./error_codes/E0689.md"),
384385
E0690: include_str!("./error_codes/E0690.md"),
385386
E0691: include_str!("./error_codes/E0691.md"),
@@ -600,7 +601,6 @@ E0751: include_str!("./error_codes/E0751.md"),
600601
// E0645, // trait aliases not finished
601602
E0667, // `impl Trait` in projections
602603
E0687, // in-band lifetimes cannot be used in `fn`/`Fn` syntax
603-
E0688, // in-band lifetimes cannot be mixed with explicit lifetime binders
604604
// E0694, // an unknown tool name found in scoped attributes
605605
E0696, // `continue` pointing to a labeled block
606606
// E0702, // replaced with a generic attribute input check
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
```

src/test/ui/in-band-lifetimes/E0688.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ LL | impl<'b> Foo<'a> {
2424

2525
error: aborting due to 3 previous errors
2626

27+
For more information about this error, try `rustc --explain E0688`.

0 commit comments

Comments
 (0)