about summary refs log tree commit diff
path: root/src/librustc_error_codes/error_codes
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2020-07-13 22:23:15 -0700
committerGitHub <noreply@github.com>2020-07-13 22:23:15 -0700
commit9a1df31d5581811516874f24a2896ba682422bcc (patch)
treea288820eaba278c687bb3f088e40c19ad999dd4c /src/librustc_error_codes/error_codes
parentfa4ada1a862f6ba0a2953e899f472cc358de3533 (diff)
parentbc2b37aad7f9cbd1c97e416e6b16325b607422b8 (diff)
Rollup merge of #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 #61137

r? @GuillaumeGomez
Diffstat (limited to 'src/librustc_error_codes/error_codes')
-rw-r--r--src/librustc_error_codes/error_codes/E0688.md36
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() {}
+}
+```