mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-01-12 08:30:51 +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 crate::db;
|
||||||
use salsa::{Database, SweepStrategy};
|
use salsa::{Database, SweepStrategy};
|
||||||
use std::sync::atomic::{AtomicU32, Ordering};
|
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
/// Query group for tests for how interned keys interact with GC.
|
/// Query group for tests for how interned keys interact with GC.
|
||||||
#[salsa::query_group(Volatile)]
|
#[salsa::query_group(Volatile)]
|
||||||
pub(crate) trait VolatileDatabase {
|
pub(crate) trait VolatileDatabase {
|
||||||
#[salsa::input]
|
#[salsa::input]
|
||||||
fn atomic_cell(&self) -> Arc<AtomicU32>;
|
fn atomic_cell(&self) -> Arc<AtomicUsize>;
|
||||||
|
|
||||||
/// Underlying volatile query.
|
/// Underlying volatile query.
|
||||||
#[salsa::volatile]
|
#[salsa::volatile]
|
||||||
fn volatile(&self) -> u32;
|
fn volatile(&self) -> usize;
|
||||||
|
|
||||||
/// This just executes the intern query and returns the result.
|
/// This just executes the intern query and returns the result.
|
||||||
fn repeat1(&self) -> u32;
|
fn repeat1(&self) -> usize;
|
||||||
|
|
||||||
/// Same as `repeat_intern1`. =)
|
/// 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)
|
db.atomic_cell().load(Ordering::SeqCst)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn repeat1(db: &impl VolatileDatabase) -> u32 {
|
fn repeat1(db: &impl VolatileDatabase) -> usize {
|
||||||
db.volatile()
|
db.volatile()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn repeat2(db: &impl VolatileDatabase) -> u32 {
|
fn repeat2(db: &impl VolatileDatabase) -> usize {
|
||||||
db.volatile()
|
db.volatile()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ fn repeat2(db: &impl VolatileDatabase) -> u32 {
|
||||||
fn consistency_no_gc() {
|
fn consistency_no_gc() {
|
||||||
let mut db = db::DatabaseImpl::default();
|
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());
|
db.set_atomic_cell(cell.clone());
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ fn consistency_no_gc() {
|
||||||
fn consistency_with_gc() {
|
fn consistency_with_gc() {
|
||||||
let mut db = db::DatabaseImpl::default();
|
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());
|
db.set_atomic_cell(cell.clone());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue