diff options
Diffstat (limited to 'compiler/rustc_error_codes/src/error_codes/E0496.md')
-rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0496.md | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0496.md b/compiler/rustc_error_codes/src/error_codes/E0496.md new file mode 100644 index 000000000..83d65cd3e --- /dev/null +++ b/compiler/rustc_error_codes/src/error_codes/E0496.md @@ -0,0 +1,31 @@ +A lifetime name is shadowing another lifetime name. + +Erroneous code example: + +```compile_fail,E0496 +struct Foo<'a> { + a: &'a i32, +} + +impl<'a> Foo<'a> { + fn f<'a>(x: &'a i32) { // error: lifetime name `'a` shadows a lifetime + // name that is already in scope + } +} +``` + +Please change the name of one of the lifetimes to remove this error. Example: + +``` +struct Foo<'a> { + a: &'a i32, +} + +impl<'a> Foo<'a> { + fn f<'b>(x: &'b i32) { // ok! + } +} + +fn main() { +} +``` |