From e9ae64cca7fd5f88b8c94dbb464594ca13f26792 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 20 May 2020 12:02:52 +0200 Subject: [PATCH] Improve E0599 explanation --- src/librustc_error_codes/error_codes/E0599.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/librustc_error_codes/error_codes/E0599.md b/src/librustc_error_codes/error_codes/E0599.md index c44e60571e1..5b1590b2999 100644 --- a/src/librustc_error_codes/error_codes/E0599.md +++ b/src/librustc_error_codes/error_codes/E0599.md @@ -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! +```