diff options
| author | bors <bors@rust-lang.org> | 2015-02-19 18:36:59 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-02-19 18:36:59 +0000 |
| commit | 522d09dfecbeca1595f25ac58c6d0178bbd21d7d (patch) | |
| tree | cc0252dd3413e5f890d0ebcfdaa096e5b002be0b /src/librustc/middle/infer/unify.rs | |
| parent | 0b664bb8436f2cfda7f13a6f302ab486f332816f (diff) | |
| parent | 49771bafa5fca16486bfd06741dac3de2c587adf (diff) | |
| download | rust-1.0.0-alpha.2.tar.gz rust-1.0.0-alpha.2.zip | |
Auto merge of #22541 - Manishearth:rollup, r=Gankro 1.0.0-alpha.2
Continued from #22520
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() } } |
