]> git.lizzy.rs Git - rust.git/commitdiff
Clean up E0263 explanation
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Sun, 2 Feb 2020 14:28:18 +0000 (15:28 +0100)
committerGitHub <noreply@github.com>
Sun, 2 Feb 2020 14:28:18 +0000 (15:28 +0100)
src/librustc_error_codes/error_codes/E0263.md

index bb4da43b3f58bd5e212dfbbe0b58aeb2c6230d0a..37271ac692d55fdbd1b4921c94a9311cf958ed4a 100644 (file)
@@ -1,7 +1,16 @@
-A lifetime name cannot be declared more than once in the same scope. For
-example:
+A lifetime was declared more than once in the same scope.
+
+Erroneous code example:
 
 ```compile_fail,E0263
-// error, lifetime name `'a` declared twice in the same scope
-fn foo<'a, 'b, 'a>(x: &'a str, y: &'b str) { }
+fn foo<'a, 'b, 'a>(x: &'a str, y: &'b str, z: &'a str) { // error!
+}
+```
+
+Two lifetimes cannot have the same name. To fix this example, change
+the second `'a` lifetime into something else (`'c` for example):
+
+```
+fn foo<'a, 'b, 'c>(x: &'a str, y: &'b str, z: &'c str) { // ok!
+}
 ```