File tree 2 files changed +15
-7
lines changed
src/librustc_error_codes/error_codes
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
+
2
3
Erroneous code example:
3
4
4
5
``` compile_fail,E0195
@@ -16,7 +17,7 @@ impl Trait for Foo {
16
17
}
17
18
```
18
19
19
- The lifetime constraint ` 'b ` for bar() implementation does not match the
20
+ The lifetime constraint ` 'b ` for ` bar() ` implementation does not match the
20
21
trait declaration. Ensure lifetime declarations match exactly in both trait
21
22
declaration and implementation. Example:
22
23
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
+
1
11
Inherent implementations (one that do not implement a trait but provide
2
12
methods associated with a type) are always safe because they are not
3
13
implementing an unsafe trait. Removing the ` unsafe ` keyword from the inherent
4
14
implementation will resolve this error.
5
15
6
- ``` compile_fail,E0197
16
+ ```
7
17
struct Foo;
8
18
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!
13
20
```
You can’t perform that action at this time.
0 commit comments