Skip to content

Commit a58b17f

Browse files
committed
update rustdocs for frozen
1 parent da4e33a commit a58b17f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/librustc_data_structures/frozen.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! An immutable, owned value.
1+
//! An immutable, owned value (except for interior mutability).
22
//!
33
//! The purpose of `Frozen` is to make a value immutable for the sake of defensive programming. For example,
44
//! suppose we have the following:
@@ -37,6 +37,12 @@
3737
//! `Frozen` impls `Deref`, so we can ergonomically call methods on `Bar`, but it doesn't `impl
3838
//! DerefMut`. Now calling `foo.compute.mutate()` will result in a compile-time error stating that
3939
//! `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)`).
4046
4147
/// An owned immutable value.
4248
#[derive(Debug)]

0 commit comments

Comments
 (0)