Rollup merge of #68247 - GuillaumeGomez:clean-up-err-codes, r=Dylan-DPC
Clean up err codes r? @Dylan-DPC
This commit is contained in:
commit
a29ba00107
2 changed files with 15 additions and 7 deletions
|
|
@ -1,4 +1,5 @@
|
|||
Your method's lifetime parameters do not match the trait declaration.
|
||||
The lifetime parameters of the method do not match the trait declaration.
|
||||
|
||||
Erroneous code example:
|
||||
|
||||
```compile_fail,E0195
|
||||
|
|
@ -16,7 +17,7 @@ impl Trait for Foo {
|
|||
}
|
||||
```
|
||||
|
||||
The lifetime constraint `'b` for bar() implementation does not match the
|
||||
The lifetime constraint `'b` for `bar()` implementation does not match the
|
||||
trait declaration. Ensure lifetime declarations match exactly in both trait
|
||||
declaration and implementation. Example:
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,20 @@
|
|||
An inherent implementation was marked unsafe.
|
||||
|
||||
Erroneous code example:
|
||||
|
||||
```compile_fail,E0197
|
||||
struct Foo;
|
||||
|
||||
unsafe impl Foo { } // error!
|
||||
```
|
||||
|
||||
Inherent implementations (one that do not implement a trait but provide
|
||||
methods associated with a type) are always safe because they are not
|
||||
implementing an unsafe trait. Removing the `unsafe` keyword from the inherent
|
||||
implementation will resolve this error.
|
||||
|
||||
```compile_fail,E0197
|
||||
```
|
||||
struct Foo;
|
||||
|
||||
// this will cause this error
|
||||
unsafe impl Foo { }
|
||||
// converting it to this will fix it
|
||||
impl Foo { }
|
||||
impl Foo { } // ok!
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue