File tree 1 file changed +7
-1
lines changed
src/librustc_data_structures
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 1
- //! An immutable, owned value.
1
+ //! An immutable, owned value (except for interior mutability) .
2
2
//!
3
3
//! The purpose of `Frozen` is to make a value immutable for the sake of defensive programming. For example,
4
4
//! suppose we have the following:
37
37
//! `Frozen` impls `Deref`, so we can ergonomically call methods on `Bar`, but it doesn't `impl
38
38
//! DerefMut`. Now calling `foo.compute.mutate()` will result in a compile-time error stating that
39
39
//! `mutate` requires a mutable reference but we don't have one.
40
+ //!
41
+ //! # Caveats
42
+ //!
43
+ //! - `Frozen` doesn't try to defend against interior mutability (e.g. `Frozen<RefCell<Bar>>`).
44
+ //! - `Frozen` doesn't pin it's contents (e.g. one could still do `foo.computed =
45
+ //! Frozen::freeze(new_bar)`).
40
46
41
47
/// An owned immutable value.
42
48
#[ derive( Debug ) ]
You can’t perform that action at this time.
0 commit comments