diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index ec7d366c3f5ce90fbd24cb2d3be6af7a2d352feb..689cf319bd750bd1c710e135c4ee0bd2f54d157d 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -207,8 +207,8 @@ /// /// # Examples /// -/// Here you can see how using `Cell` allows to use mutable field inside -/// immutable struct (which is also called 'interior mutability'). +/// In this example, you can see that `Cell` enables mutation inside an +/// immutable struct. In other words, it enables "interior mutability". /// /// ``` /// use std::cell::Cell; @@ -225,10 +225,11 @@ /// /// let new_value = 100; /// -/// // ERROR, because my_struct is immutable +/// // ERROR: `my_struct` is immutable /// // my_struct.regular_field = new_value; /// -/// // WORKS, although `my_struct` is immutable, field `special_field` is mutable because it is Cell +/// // WORKS: although `my_struct` is immutable, `special_field` is a `Cell`, +/// // which can always be mutated /// my_struct.special_field.set(new_value); /// assert_eq!(my_struct.special_field.get(), new_value); /// ```