diff options
| author | PankajChaudhary5 <pankajchaudhary172@gmail.com> | 2020-07-13 14:05:48 +0530 |
|---|---|---|
| committer | PankajChaudhary5 <pankajchaudhary172@gmail.com> | 2020-07-13 14:05:48 +0530 |
| commit | e3ae4c7345cfd06b06c6996536d7c158ce6970db (patch) | |
| tree | 660819a2f019a6206a4dfdd95c33c93b76db4741 /src/librustc_error_codes/error_codes | |
| parent | 20fc02f836f3035b86b56a7cedb97c5cd4ed9612 (diff) | |
| download | rust-e3ae4c7345cfd06b06c6996536d7c158ce6970db.tar.gz rust-e3ae4c7345cfd06b06c6996536d7c158ce6970db.zip | |
Added proper explanation of ErrorCode-E0688
Diffstat (limited to 'src/librustc_error_codes/error_codes')
| -rw-r--r-- | src/librustc_error_codes/error_codes/E0688.md | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/librustc_error_codes/error_codes/E0688.md b/src/librustc_error_codes/error_codes/E0688.md new file mode 100644 index 00000000000..db50f490208 --- /dev/null +++ b/src/librustc_error_codes/error_codes/E0688.md @@ -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() {} +} +``` |
