Skip to content

Commit b1c931d

Browse files
authored
Rollup merge of rust-lang#74286 - PankajChaudhary5:E0688, r=GuillaumeGomez
Added detailed error code explanation for issue E0688 in Rust compiler. Added proper error explanation for issue E0688 in the Rust compiler. Error Code E0688 Sub Part of Issue rust-lang#61137 r? @GuillaumeGomez
2 parents c010339 + bc2b37a commit b1c931d

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
@@ -383,6 +383,7 @@ E0669: include_str!("./error_codes/E0669.md"),
383383
E0670: include_str!("./error_codes/E0670.md"),
384384
E0671: include_str!("./error_codes/E0671.md"),
385385
E0687: include_str!("./error_codes/E0687.md"),
386+
E0688: include_str!("./error_codes/E0688.md"),
386387
E0689: include_str!("./error_codes/E0689.md"),
387388
E0690: include_str!("./error_codes/E0690.md"),
388389
E0691: include_str!("./error_codes/E0691.md"),
@@ -617,7 +618,6 @@ E0769: include_str!("./error_codes/E0769.md"),
617618
E0640, // infer outlives requirements
618619
// E0645, // trait aliases not finished
619620
E0667, // `impl Trait` in projections
620-
E0688, // in-band lifetimes cannot be mixed with explicit lifetime binders
621621
// E0694, // an unknown tool name found in scoped attributes
622622
// E0702, // replaced with a generic attribute input check
623623
// E0707, // multiple elided lifetimes used in arguments of `async fn`
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)