diff options
Diffstat (limited to 'src/librustc/middle/infer/unify.rs')
| -rw-r--r-- | src/librustc/middle/infer/unify.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/librustc/middle/infer/unify.rs b/src/librustc/middle/infer/unify.rs index 235f3f994c6..0675cec6f69 100644 --- a/src/librustc/middle/infer/unify.rs +++ b/src/librustc/middle/infer/unify.rs @@ -18,6 +18,7 @@ use middle::infer::{uok, ures}; use middle::infer::InferCtxt; use std::cell::RefCell; use std::fmt::Debug; +use std::marker::PhantomData; use syntax::ast; use util::snapshot_vec as sv; @@ -79,7 +80,7 @@ pub struct UnificationTable<K:UnifyKey> { /// made during the snapshot may either be *committed* or *rolled back*. pub struct Snapshot<K:UnifyKey> { // Link snapshot to the key type `K` of the table. - marker: marker::CovariantType<K>, + marker: marker::PhantomData<K>, snapshot: sv::Snapshot, } @@ -92,7 +93,7 @@ pub struct Node<K:UnifyKey> { } #[derive(Copy)] -pub struct Delegate<K>; +pub struct Delegate<K>(PhantomData<K>); // We can't use V:LatticeValue, much as I would like to, // because frequently the pattern is that V=Option<U> for some @@ -102,14 +103,14 @@ pub struct Delegate<K>; impl<K:UnifyKey> UnificationTable<K> { pub fn new() -> UnificationTable<K> { UnificationTable { - values: sv::SnapshotVec::new(Delegate), + values: sv::SnapshotVec::new(Delegate(PhantomData)), } } /// Starts a new snapshot. Each snapshot must be either /// rolled back or committed in a "LIFO" (stack) order. pub fn snapshot(&mut self) -> Snapshot<K> { - Snapshot { marker: marker::CovariantType::<K>, + Snapshot { marker: marker::PhantomData::<K>, snapshot: self.values.start_snapshot() } } |
