Skip to content

Commit 97c98d8

Browse files
committed
---
yaml --- r: 183925 b: refs/heads/master c: b3c00a6 h: refs/heads/master i: 183923: ab4060b v: v3
1 parent 59ec6b0 commit 97c98d8

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: c5579ca340b346f1b685887f7784c2e7f2090dcb
2+
refs/heads/master: b3c00a69f23b68cba2901eb98b3de7dfc6990396
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 522d09dfecbeca1595f25ac58c6d0178bbd21d7d
55
refs/heads/try: ccf8fedf1cffcb8f6f3581d53d220039e192fe77

trunk/src/libcollections/btree/map.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -512,13 +512,22 @@ mod stack {
512512
use super::super::node::handle;
513513
use vec::Vec;
514514

515+
struct InvariantLifetime<'id>(
516+
marker::PhantomData<::core::cell::Cell<&'id ()>>);
517+
518+
impl<'id> InvariantLifetime<'id> {
519+
fn new() -> InvariantLifetime<'id> {
520+
InvariantLifetime(marker::PhantomData)
521+
}
522+
}
523+
515524
/// A generic mutable reference, identical to `&mut` except for the fact that its lifetime
516525
/// parameter is invariant. This means that wherever an `IdRef` is expected, only an `IdRef`
517526
/// with the exact requested lifetime can be used. This is in contrast to normal references,
518527
/// where `&'static` can be used in any function expecting any lifetime reference.
519528
pub struct IdRef<'id, T: 'id> {
520529
inner: &'id mut T,
521-
marker: marker::InvariantLifetime<'id>
530+
_marker: InvariantLifetime<'id>,
522531
}
523532

524533
impl<'id, T> Deref for IdRef<'id, T> {
@@ -560,7 +569,7 @@ mod stack {
560569
pub struct Pusher<'id, 'a, K:'a, V:'a> {
561570
map: &'a mut BTreeMap<K, V>,
562571
stack: Stack<K, V>,
563-
marker: marker::InvariantLifetime<'id>
572+
_marker: InvariantLifetime<'id>,
564573
}
565574

566575
impl<'a, K, V> PartialSearchStack<'a, K, V> {
@@ -595,11 +604,11 @@ mod stack {
595604
let pusher = Pusher {
596605
map: self.map,
597606
stack: self.stack,
598-
marker: marker::InvariantLifetime
607+
_marker: InvariantLifetime::new(),
599608
};
600609
let node = IdRef {
601610
inner: unsafe { &mut *self.next },
602-
marker: marker::InvariantLifetime
611+
_marker: InvariantLifetime::new(),
603612
};
604613

605614
closure(pusher, node)

0 commit comments

Comments
 (0)