diff options
| author | Mark Mansi <markm@cs.wisc.edu> | 2020-03-13 13:36:16 -0500 |
|---|---|---|
| committer | Mark Mansi <markm@cs.wisc.edu> | 2020-03-13 13:36:16 -0500 |
| commit | a58b17f2b5e57baa45ffb5b8c979faa3191bc05a (patch) | |
| tree | 23cf13c1b35af552603de3829a321f90539f1b0e /src/librustc_data_structures | |
| parent | da4e33a9e659071ae5e7418242dea38d951a260d (diff) | |
update rustdocs for frozen
Diffstat (limited to 'src/librustc_data_structures')
| -rw-r--r-- | src/librustc_data_structures/frozen.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/librustc_data_structures/frozen.rs b/src/librustc_data_structures/frozen.rs index 835fa7d839c..2daf5b04141 100644 --- a/src/librustc_data_structures/frozen.rs +++ b/src/librustc_data_structures/frozen.rs @@ -1,4 +1,4 @@ -//! An immutable, owned value. +//! An immutable, owned value (except for interior mutability). //! //! The purpose of `Frozen` is to make a value immutable for the sake of defensive programming. For example, //! suppose we have the following: @@ -37,6 +37,12 @@ //! `Frozen` impls `Deref`, so we can ergonomically call methods on `Bar`, but it doesn't `impl //! DerefMut`. Now calling `foo.compute.mutate()` will result in a compile-time error stating that //! `mutate` requires a mutable reference but we don't have one. +//! +//! # Caveats +//! +//! - `Frozen` doesn't try to defend against interior mutability (e.g. `Frozen<RefCell<Bar>>`). +//! - `Frozen` doesn't pin it's contents (e.g. one could still do `foo.computed = +//! Frozen::freeze(new_bar)`). /// An owned immutable value. #[derive(Debug)] |
