Skip to content

Commit 51c6c25

Browse files
authored
Rollup merge of #68777 - GuillaumeGomez:clean-up-e0263, r=Dylan-DPC
Clean up E0263 explanation r? @Dylan-DPC
2 parents 95d1f6f + 019ca55 commit 51c6c25

File tree

1 file changed

+13
-4
lines changed
  • src/librustc_error_codes/error_codes

1 file changed

+13
-4
lines changed
+13-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1-
A lifetime name cannot be declared more than once in the same scope. For
2-
example:
1+
A lifetime was declared more than once in the same scope.
2+
3+
Erroneous code example:
34

45
```compile_fail,E0263
5-
// error, lifetime name `'a` declared twice in the same scope
6-
fn foo<'a, 'b, 'a>(x: &'a str, y: &'b str) { }
6+
fn foo<'a, 'b, 'a>(x: &'a str, y: &'b str, z: &'a str) { // error!
7+
}
8+
```
9+
10+
Two lifetimes cannot have the same name. To fix this example, change
11+
the second `'a` lifetime into something else (`'c` for example):
12+
13+
```
14+
fn foo<'a, 'b, 'c>(x: &'a str, y: &'b str, z: &'c str) { // ok!
15+
}
716
```

0 commit comments

Comments
 (0)