File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
branches/beta/src/libcore Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
31
31
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
32
32
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
33
33
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
34
- refs/heads/beta: b6544fd3520d5eed05aafeb6b78737e32bf2c435
34
+ refs/heads/beta: 310ada06f2d632340845ccd4d7e68a1b54d2f28a
35
35
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
36
36
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
37
37
refs/heads/tmp: eb836bf767aa1d8d4cba488a9091cde3c0ab4b2f
Original file line number Diff line number Diff line change @@ -308,6 +308,20 @@ impl<T: ?Sized> Clone for ContravariantType<T> {
308
308
///
309
309
/// For more information about variance, refer to this Uncyclopedia
310
310
/// 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.
311
325
#[ unstable( feature = "core" ,
312
326
reason = "likely to change with new variance strategy" ) ]
313
327
#[ lang="invariant_type" ]
You can’t perform that action at this time.
0 commit comments