mirror of
https://github.com/salsa-rs/salsa.git
synced 2024-12-24 12:58:37 +00:00
s/AtomicU32/AtomicUsize/ in tests
This commit is contained in:
parent
f0d2b964e2
commit
5c7e2fee09
1 changed files with 10 additions and 10 deletions
|
@ -1,34 +1,34 @@
|
|||
use crate::db;
|
||||
use salsa::{Database, SweepStrategy};
|
||||
use std::sync::atomic::{AtomicU32, Ordering};
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::sync::Arc;
|
||||
|
||||
/// Query group for tests for how interned keys interact with GC.
|
||||
#[salsa::query_group(Volatile)]
|
||||
pub(crate) trait VolatileDatabase {
|
||||
#[salsa::input]
|
||||
fn atomic_cell(&self) -> Arc<AtomicU32>;
|
||||
fn atomic_cell(&self) -> Arc<AtomicUsize>;
|
||||
|
||||
/// Underlying volatile query.
|
||||
#[salsa::volatile]
|
||||
fn volatile(&self) -> u32;
|
||||
fn volatile(&self) -> usize;
|
||||
|
||||
/// This just executes the intern query and returns the result.
|
||||
fn repeat1(&self) -> u32;
|
||||
fn repeat1(&self) -> usize;
|
||||
|
||||
/// Same as `repeat_intern1`. =)
|
||||
fn repeat2(&self) -> u32;
|
||||
fn repeat2(&self) -> usize;
|
||||
}
|
||||
|
||||
fn volatile(db: &impl VolatileDatabase) -> u32 {
|
||||
fn volatile(db: &impl VolatileDatabase) -> usize {
|
||||
db.atomic_cell().load(Ordering::SeqCst)
|
||||
}
|
||||
|
||||
fn repeat1(db: &impl VolatileDatabase) -> u32 {
|
||||
fn repeat1(db: &impl VolatileDatabase) -> usize {
|
||||
db.volatile()
|
||||
}
|
||||
|
||||
fn repeat2(db: &impl VolatileDatabase) -> u32 {
|
||||
fn repeat2(db: &impl VolatileDatabase) -> usize {
|
||||
db.volatile()
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ fn repeat2(db: &impl VolatileDatabase) -> u32 {
|
|||
fn consistency_no_gc() {
|
||||
let mut db = db::DatabaseImpl::default();
|
||||
|
||||
let cell = Arc::new(AtomicU32::new(22));
|
||||
let cell = Arc::new(AtomicUsize::new(22));
|
||||
|
||||
db.set_atomic_cell(cell.clone());
|
||||
|
||||
|
@ -53,7 +53,7 @@ fn consistency_no_gc() {
|
|||
fn consistency_with_gc() {
|
||||
let mut db = db::DatabaseImpl::default();
|
||||
|
||||
let cell = Arc::new(AtomicU32::new(22));
|
||||
let cell = Arc::new(AtomicUsize::new(22));
|
||||
|
||||
db.set_atomic_cell(cell.clone());
|
||||
|
||||
|
|
Loading…
Reference in a new issue