Merge pull request #141 from memoryruins/remove-unchecked-set-trait

remove `UncheckedMutQueryStorageOps` trait
This commit is contained in:
Niko Matsakis 2019-01-28 04:47:38 -05:00 committed by GitHub
commit 541b4beade
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 0 additions and 60 deletions

View file

@ -4,7 +4,6 @@ use crate::plumbing::DatabaseKey;
use crate::plumbing::QueryFunction;
use crate::plumbing::QueryStorageMassOps;
use crate::plumbing::QueryStorageOps;
use crate::plumbing::UncheckedMutQueryStorageOps;
use crate::runtime::ChangedAt;
use crate::runtime::FxIndexSet;
use crate::runtime::Revision;
@ -983,31 +982,6 @@ where
}
}
impl<DB, Q, MP> UncheckedMutQueryStorageOps<DB, Q> for DerivedStorage<DB, Q, MP>
where
Q: QueryFunction<DB>,
DB: Database,
MP: MemoizationPolicy<DB, Q>,
{
fn set_unchecked(&self, db: &DB, key: &Q::Key, value: Q::Value) {
let key = key.clone();
let mut map_write = self.map.write();
let current_revision = db.salsa_runtime().current_revision();
map_write.insert(
key,
QueryState::Memoized(Memo {
value: Some(value),
changed_at: current_revision,
verified_at: current_revision,
inputs: MemoInputs::Tracked {
inputs: Default::default(),
},
}),
);
}
}
impl<DB, Q> Memo<DB, Q>
where
Q: QueryFunction<DB>,

View file

@ -3,7 +3,6 @@ use crate::plumbing::CycleDetected;
use crate::plumbing::InputQueryStorageOps;
use crate::plumbing::QueryStorageMassOps;
use crate::plumbing::QueryStorageOps;
use crate::plumbing::UncheckedMutQueryStorageOps;
use crate::runtime::ChangedAt;
use crate::runtime::Revision;
use crate::runtime::StampedValue;
@ -233,24 +232,3 @@ where
self.set_common(db, key, database_key, value, IsConstant(true))
}
}
impl<DB, Q> UncheckedMutQueryStorageOps<DB, Q> for InputStorage<DB, Q>
where
Q: Query<DB>,
DB: Database,
{
fn set_unchecked(&self, db: &DB, key: &Q::Key, value: Q::Value) {
let key = key.clone();
let mut map_write = self.map.write();
// Unlike with `set`, here we use the **current revision** and
// do not create a new one.
let changed_at = ChangedAt {
is_constant: false,
revision: db.salsa_runtime().current_revision(),
};
map_write.insert(key, StampedValue { value, changed_at });
}
}

View file

@ -22,7 +22,6 @@ use crate::plumbing::CycleDetected;
use crate::plumbing::InputQueryStorageOps;
use crate::plumbing::QueryStorageMassOps;
use crate::plumbing::QueryStorageOps;
use crate::plumbing::UncheckedMutQueryStorageOps;
use derive_new::new;
use std::fmt::{self, Debug};
use std::hash::Hash;

View file

@ -201,14 +201,3 @@ where
new_value: Q::Value,
);
}
/// An optional trait that is implemented for "user mutable" storage:
/// that is, storage whose value is not derived from other storage but
/// is set independently.
pub trait UncheckedMutQueryStorageOps<DB, Q>: Default
where
DB: Database,
Q: Query<DB>,
{
fn set_unchecked(&self, db: &DB, key: &Q::Key, new_value: Q::Value);
}