]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0496.md
Rollup merge of #92310 - ehuss:rustdoc-ice, r=estebank
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0496.md
1 A lifetime name is shadowing another lifetime name.
2
3 Erroneous code example:
4
5 ```compile_fail,E0496
6 struct Foo<'a> {
7     a: &'a i32,
8 }
9
10 impl<'a> Foo<'a> {
11     fn f<'a>(x: &'a i32) { // error: lifetime name `'a` shadows a lifetime
12                            //        name that is already in scope
13     }
14 }
15 ```
16
17 Please change the name of one of the lifetimes to remove this error. Example:
18
19 ```
20 struct Foo<'a> {
21     a: &'a i32,
22 }
23
24 impl<'a> Foo<'a> {
25     fn f<'b>(x: &'b i32) { // ok!
26     }
27 }
28
29 fn main() {
30 }
31 ```