forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#74286 - PankajChaudhary5:E0688, r=Guillaume…
…Gomez 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
- Loading branch information
Showing
3 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
In-band lifetimes were mixed with explicit lifetime binders. | ||
|
||
Erroneous code example: | ||
|
||
```compile_fail,E0688 | ||
#![feature(in_band_lifetimes)] | ||
fn foo<'a>(x: &'a u32, y: &'b u32) {} // error! | ||
struct Foo<'a> { x: &'a u32 } | ||
impl Foo<'a> { | ||
fn bar<'b>(x: &'a u32, y: &'b u32, z: &'c u32) {} // error! | ||
} | ||
impl<'b> Foo<'a> { // error! | ||
fn baz() {} | ||
} | ||
``` | ||
|
||
In-band lifetimes cannot be mixed with explicit lifetime binders. | ||
For example: | ||
|
||
``` | ||
fn foo<'a, 'b>(x: &'a u32, y: &'b u32) {} // ok! | ||
struct Foo<'a> { x: &'a u32 } | ||
impl<'a> Foo<'a> { | ||
fn bar<'b,'c>(x: &'a u32, y: &'b u32, z: &'c u32) {} // ok! | ||
} | ||
impl<'a> Foo<'a> { // ok! | ||
fn baz() {} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters