Rollup merge of #72375 - GuillaumeGomez:cleanup-e0599, r=Dylan-DPC
Improve E0599 explanation r? @Dylan-DPC
This commit is contained in:
commit
47f3c440ec
1 changed files with 15 additions and 0 deletions
|
|
@ -9,3 +9,18 @@ let x = Mouth;
|
|||
x.chocolate(); // error: no method named `chocolate` found for type `Mouth`
|
||||
// in the current scope
|
||||
```
|
||||
|
||||
In this case, you need to implement the `chocolate` method to fix the error:
|
||||
|
||||
```
|
||||
struct Mouth;
|
||||
|
||||
impl Mouth {
|
||||
fn chocolate(&self) { // We implement the `chocolate` method here.
|
||||
println!("Hmmm! I love chocolate!");
|
||||
}
|
||||
}
|
||||
|
||||
let x = Mouth;
|
||||
x.chocolate(); // ok!
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue