File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed
src/librustc_error_codes/error_codes Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change 1- Your method's lifetime parameters do not match the trait declaration.
1+ The lifetime parameters of the method do not match the trait declaration.
2+
23Erroneous code example:
34
45``` compile_fail,E0195
@@ -16,7 +17,7 @@ impl Trait for Foo {
1617}
1718```
1819
19- The lifetime constraint ` 'b ` for bar() implementation does not match the
20+ The lifetime constraint ` 'b ` for ` bar() ` implementation does not match the
2021trait declaration. Ensure lifetime declarations match exactly in both trait
2122declaration and implementation. Example:
2223
Original file line number Diff line number Diff line change 1+ An inherent implementation was marked unsafe.
2+
3+ Erroneous code example:
4+
5+ ``` compile_fail,E0197
6+ struct Foo;
7+
8+ unsafe impl Foo { } // error!
9+ ```
10+
111Inherent implementations (one that do not implement a trait but provide
212methods associated with a type) are always safe because they are not
313implementing an unsafe trait. Removing the ` unsafe ` keyword from the inherent
414implementation will resolve this error.
515
6- ``` compile_fail,E0197
16+ ```
717struct Foo;
818
9- // this will cause this error
10- unsafe impl Foo { }
11- // converting it to this will fix it
12- impl Foo { }
19+ impl Foo { } // ok!
1320```
You can’t perform that action at this time.
0 commit comments