From ceacd6d75f9155163f6a605a2d52f9297601de8b Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Wed, 17 Apr 2024 15:57:05 -0600 Subject: [PATCH] Revert "Chapter 15-05: Fix incorrect interpretation of compiler error" --- src/ch15-05-interior-mutability.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/ch15-05-interior-mutability.md b/src/ch15-05-interior-mutability.md index d8f51b31..7b5e825d 100644 --- a/src/ch15-05-interior-mutability.md +++ b/src/ch15-05-interior-mutability.md @@ -191,10 +191,9 @@ However, there’s one problem with this test, as shown here: We can’t modify the `MockMessenger` to keep track of the messages, because the `send` method takes an immutable reference to `self`. We also can’t take the -suggestion from the error text to use `&mut self` instead, because we are -testing an API and it's not a good idea to modify the API for the sole purpose -of testing. Usually, the test engineers do not have permission to modify the -API they're testing. Feel free to try and see what error message you get. +suggestion from the error text to use `&mut self` instead, because then the +signature of `send` wouldn’t match the signature in the `Messenger` trait +definition (feel free to try and see what error message you get). This is a situation in which interior mutability can help! We’ll store the `sent_messages` within a `RefCell`, and then the `send` method will be