Skip to content

Commit 161575e

Browse files
author
Junseok Lee
committed
---
yaml --- r: 183255 b: refs/heads/beta c: 310ada0 h: refs/heads/master i: 183253: 2bb6745 183251: 77c8de1 183247: 257c859 v: v3
1 parent 7c85104 commit 161575e

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
3232
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
34-
refs/heads/beta: b6544fd3520d5eed05aafeb6b78737e32bf2c435
34+
refs/heads/beta: 310ada06f2d632340845ccd4d7e68a1b54d2f28a
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3737
refs/heads/tmp: eb836bf767aa1d8d4cba488a9091cde3c0ab4b2f

branches/beta/src/libcore/marker.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,20 @@ impl<T: ?Sized> Clone for ContravariantType<T> {
308308
///
309309
/// For more information about variance, refer to this Uncyclopedia
310310
/// article <http://en.wikipedia.org/wiki/Variance_%28computer_science%29>.
311+
///
312+
/// # Example
313+
///
314+
/// The Cell type is an example of an `InvariantType` which uses unsafe
315+
/// code to achieve "interior" mutability:
316+
///
317+
/// ```
318+
/// struct Cell<T> { value: T }
319+
/// ```
320+
///
321+
/// The type system would infer that `value` is only read here
322+
/// and never written, but in fact `Cell` uses unsafe code to achieve
323+
/// interior mutability. In order to get correct behavior, the
324+
/// `InvariantType` marker must be applied.
311325
#[unstable(feature = "core",
312326
reason = "likely to change with new variance strategy")]
313327
#[lang="invariant_type"]

0 commit comments

Comments
 (0)