mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-07-07 21:35:17 +00:00
chore: Normalize imports style (#779)
* Default impl some ingredient functions * chore: Normalize imports style Effectively reformatted everything with ```toml imports_granularity = "Module" group_imports = "StdExternalCrate" reorder_imports = true ```
This commit is contained in:
parent
20a347e147
commit
a89e3d2357
78 changed files with 398 additions and 647 deletions
|
@ -2,11 +2,12 @@
|
|||
//!
|
||||
//! This benchmark simulates a (very simplified) version of a real dataflow analysis using fixpoint
|
||||
//! iteration.
|
||||
use codspeed_criterion_compat::{criterion_group, criterion_main, BatchSize, Criterion};
|
||||
use salsa::{CycleRecoveryAction, Database as Db, Setter};
|
||||
use std::collections::BTreeSet;
|
||||
use std::iter::IntoIterator;
|
||||
|
||||
use codspeed_criterion_compat::{criterion_group, criterion_main, BatchSize, Criterion};
|
||||
use salsa::{CycleRecoveryAction, Database as Db, Setter};
|
||||
|
||||
include!("shims/global_alloc_overwrite.rs");
|
||||
|
||||
/// A Use of a symbol.
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
use proc_macro2::TokenStream;
|
||||
|
||||
use crate::{
|
||||
hygiene::Hygiene,
|
||||
options::{AllowedOptions, Options},
|
||||
token_stream_with_error,
|
||||
};
|
||||
use crate::hygiene::Hygiene;
|
||||
use crate::options::{AllowedOptions, Options};
|
||||
use crate::token_stream_with_error;
|
||||
|
||||
// #[salsa::accumulator(jar = Jar0)]
|
||||
// struct Accumulator(DataType);
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
use proc_macro2::TokenStream;
|
||||
use syn::parse::Nothing;
|
||||
|
||||
use crate::{hygiene::Hygiene, token_stream_with_error};
|
||||
use crate::hygiene::Hygiene;
|
||||
use crate::token_stream_with_error;
|
||||
|
||||
// Source:
|
||||
//
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::{hygiene::Hygiene, xform::ChangeLt};
|
||||
use crate::hygiene::Hygiene;
|
||||
use crate::xform::ChangeLt;
|
||||
|
||||
/// Returns a vector of ids representing the function arguments.
|
||||
/// Prefers to reuse the names given by the user, if possible.
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
use crate::{
|
||||
hygiene::Hygiene,
|
||||
options::Options,
|
||||
salsa_struct::{SalsaStruct, SalsaStructAllowedOptions},
|
||||
token_stream_with_error,
|
||||
};
|
||||
use proc_macro2::TokenStream;
|
||||
|
||||
use crate::hygiene::Hygiene;
|
||||
use crate::options::Options;
|
||||
use crate::salsa_struct::{SalsaStruct, SalsaStructAllowedOptions};
|
||||
use crate::token_stream_with_error;
|
||||
|
||||
/// For an entity struct `Foo` with fields `f1: T1, ..., fN: TN`, we generate...
|
||||
///
|
||||
/// * the "id struct" `struct Foo(salsa::Id)`
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
use crate::{
|
||||
db_lifetime,
|
||||
hygiene::Hygiene,
|
||||
options::Options,
|
||||
salsa_struct::{SalsaStruct, SalsaStructAllowedOptions},
|
||||
token_stream_with_error,
|
||||
};
|
||||
use proc_macro2::TokenStream;
|
||||
|
||||
use crate::hygiene::Hygiene;
|
||||
use crate::options::Options;
|
||||
use crate::salsa_struct::{SalsaStruct, SalsaStructAllowedOptions};
|
||||
use crate::{db_lifetime, token_stream_with_error};
|
||||
|
||||
/// For an entity struct `Foo` with fields `f1: T1, ..., fN: TN`, we generate...
|
||||
///
|
||||
/// * the "id struct" `struct Foo(salsa::Id)`
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use std::marker::PhantomData;
|
||||
|
||||
use syn::{ext::IdentExt, spanned::Spanned};
|
||||
use syn::ext::IdentExt;
|
||||
use syn::spanned::Spanned;
|
||||
|
||||
/// "Options" are flags that can be supplied to the various salsa related
|
||||
/// macros. They are listed like `(ref, no_eq, foo=bar)` etc. The commas
|
||||
|
|
|
@ -25,12 +25,11 @@
|
|||
//! * data method `impl Foo { fn data(&self, db: &dyn crate::Db) -> FooData { FooData { f: self.f(db), ... } } }`
|
||||
//! * this could be optimized, particularly for interned fields
|
||||
|
||||
use crate::{
|
||||
db_lifetime,
|
||||
options::{AllowedOptions, Options},
|
||||
};
|
||||
use proc_macro2::{Ident, Literal, Span, TokenStream};
|
||||
|
||||
use crate::db_lifetime;
|
||||
use crate::options::{AllowedOptions, Options};
|
||||
|
||||
pub(crate) struct SalsaStruct<'s, A: SalsaStructAllowedOptions> {
|
||||
struct_item: &'s syn::ItemStruct,
|
||||
args: &'s Options<A>,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use crate::token_stream_with_error;
|
||||
use proc_macro2::TokenStream;
|
||||
|
||||
use crate::token_stream_with_error;
|
||||
|
||||
/// The implementation of the `supertype` macro.
|
||||
///
|
||||
/// For an entity enum `Foo` with variants `Variant1, ..., VariantN`, we generate
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use syn::{spanned::Spanned, Item};
|
||||
use syn::spanned::Spanned;
|
||||
use syn::Item;
|
||||
|
||||
use crate::token_stream_with_error;
|
||||
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
use proc_macro2::{Literal, Span, TokenStream};
|
||||
use quote::ToTokens;
|
||||
use syn::{spanned::Spanned, ItemFn};
|
||||
use syn::spanned::Spanned;
|
||||
use syn::ItemFn;
|
||||
|
||||
use crate::{db_lifetime, fn_util, hygiene::Hygiene, options::Options};
|
||||
use crate::hygiene::Hygiene;
|
||||
use crate::options::Options;
|
||||
use crate::{db_lifetime, fn_util};
|
||||
|
||||
// Source:
|
||||
//
|
||||
|
|
|
@ -2,9 +2,12 @@ use std::collections::HashSet;
|
|||
|
||||
use proc_macro2::TokenStream;
|
||||
use quote::ToTokens;
|
||||
use syn::{parse::Nothing, visit_mut::VisitMut};
|
||||
use syn::parse::Nothing;
|
||||
use syn::visit_mut::VisitMut;
|
||||
|
||||
use crate::{hygiene::Hygiene, tracked_fn::FnArgs, xform::ChangeSelfPath};
|
||||
use crate::hygiene::Hygiene;
|
||||
use crate::tracked_fn::FnArgs;
|
||||
use crate::xform::ChangeSelfPath;
|
||||
|
||||
pub(crate) fn tracked_impl(
|
||||
args: proc_macro::TokenStream,
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
use crate::{
|
||||
db_lifetime,
|
||||
hygiene::Hygiene,
|
||||
options::Options,
|
||||
salsa_struct::{SalsaStruct, SalsaStructAllowedOptions},
|
||||
};
|
||||
use proc_macro2::TokenStream;
|
||||
|
||||
use crate::db_lifetime;
|
||||
use crate::hygiene::Hygiene;
|
||||
use crate::options::Options;
|
||||
use crate::salsa_struct::{SalsaStruct, SalsaStructAllowedOptions};
|
||||
|
||||
/// For an entity struct `Foo` with fields `f1: T1, ..., fN: TN`, we generate...
|
||||
///
|
||||
/// * the "id struct" `struct Foo(salsa::Id)`
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
use std::collections::HashSet;
|
||||
|
||||
use quote::ToTokens;
|
||||
use syn::{punctuated::Punctuated, spanned::Spanned, visit_mut::VisitMut};
|
||||
use syn::punctuated::Punctuated;
|
||||
use syn::spanned::Spanned;
|
||||
use syn::visit_mut::VisitMut;
|
||||
|
||||
pub(crate) struct ChangeLt<'a> {
|
||||
from: Option<&'a str>,
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
use crate::{ir::SourceProgram, parser::parse_statements, type_check::type_check_program};
|
||||
use crate::ir::SourceProgram;
|
||||
use crate::parser::parse_statements;
|
||||
use crate::type_check::type_check_program;
|
||||
|
||||
#[salsa::tracked]
|
||||
pub fn compile(db: &dyn crate::Db, source_program: SourceProgram) {
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
use crate::ir::{
|
||||
Diagnostic, Expression, Function, FunctionId, Program, Span, StatementData, VariableId,
|
||||
};
|
||||
#[cfg(test)]
|
||||
use expect_test::expect;
|
||||
use salsa::Accumulator;
|
||||
#[cfg(test)]
|
||||
use test_log::test;
|
||||
|
||||
use crate::ir::{
|
||||
Diagnostic, Expression, Function, FunctionId, Program, Span, StatementData, VariableId,
|
||||
};
|
||||
|
||||
// ANCHOR: parse_statements
|
||||
#[salsa::tracked]
|
||||
pub fn type_check_program<'db>(db: &'db dyn crate::Db, program: Program<'db>) {
|
||||
|
@ -112,7 +113,9 @@ fn check_string(
|
|||
) {
|
||||
use salsa::{Database, Setter};
|
||||
|
||||
use crate::{db::CalcDatabaseImpl, ir::SourceProgram, parser::parse_statements};
|
||||
use crate::db::CalcDatabaseImpl;
|
||||
use crate::ir::SourceProgram;
|
||||
use crate::parser::parse_statements;
|
||||
|
||||
// Create the database
|
||||
let mut db = CalcDatabaseImpl::default();
|
||||
|
|
|
@ -1,19 +1,15 @@
|
|||
#![allow(unreachable_patterns)]
|
||||
// FIXME(rust-lang/rust#129031): regression in nightly
|
||||
use std::{
|
||||
path::PathBuf,
|
||||
sync::{Arc, Mutex},
|
||||
time::Duration,
|
||||
};
|
||||
use std::path::PathBuf;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::time::Duration;
|
||||
|
||||
use crossbeam_channel::{unbounded, Sender};
|
||||
use dashmap::{mapref::entry::Entry, DashMap};
|
||||
use dashmap::mapref::entry::Entry;
|
||||
use dashmap::DashMap;
|
||||
use eyre::{eyre, Context, Report, Result};
|
||||
use notify_debouncer_mini::{
|
||||
new_debouncer,
|
||||
notify::{RecommendedWatcher, RecursiveMode},
|
||||
DebounceEventResult, Debouncer,
|
||||
};
|
||||
use notify_debouncer_mini::notify::{RecommendedWatcher, RecursiveMode};
|
||||
use notify_debouncer_mini::{new_debouncer, DebounceEventResult, Debouncer};
|
||||
use salsa::{Accumulator, Setter, Storage};
|
||||
|
||||
// ANCHOR: main
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
//! Basic test of accumulator functionality.
|
||||
|
||||
use std::{
|
||||
any::{Any, TypeId},
|
||||
fmt,
|
||||
marker::PhantomData,
|
||||
panic::UnwindSafe,
|
||||
};
|
||||
use std::any::{Any, TypeId};
|
||||
use std::fmt;
|
||||
use std::marker::PhantomData;
|
||||
use std::panic::UnwindSafe;
|
||||
|
||||
use accumulated::Accumulated;
|
||||
use accumulated::AnyAccumulated;
|
||||
use accumulated::{Accumulated, AnyAccumulated};
|
||||
|
||||
use crate::{
|
||||
function::VerifyResult,
|
||||
ingredient::{fmt_index, Ingredient, Jar},
|
||||
plumbing::IngredientIndices,
|
||||
zalsa::{IngredientIndex, Zalsa},
|
||||
zalsa_local::QueryOrigin,
|
||||
Database, DatabaseKeyIndex, Id, Revision,
|
||||
};
|
||||
use crate::function::VerifyResult;
|
||||
use crate::ingredient::{fmt_index, Ingredient, Jar};
|
||||
use crate::plumbing::IngredientIndices;
|
||||
use crate::zalsa::{IngredientIndex, Zalsa};
|
||||
use crate::{Database, Id, Revision};
|
||||
|
||||
mod accumulated;
|
||||
pub(crate) mod accumulated_map;
|
||||
|
@ -109,35 +103,6 @@ impl<A: Accumulator> Ingredient for IngredientImpl<A> {
|
|||
panic!("nothing should ever depend on an accumulator directly")
|
||||
}
|
||||
|
||||
fn is_provisional_cycle_head<'db>(&'db self, _db: &'db dyn Database, _input: Id) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn wait_for(&self, _db: &dyn Database, _key_index: Id) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn origin(&self, _db: &dyn Database, _key_index: crate::Id) -> Option<QueryOrigin> {
|
||||
None
|
||||
}
|
||||
|
||||
fn mark_validated_output(
|
||||
&self,
|
||||
_db: &dyn Database,
|
||||
_executor: DatabaseKeyIndex,
|
||||
_output_key: crate::Id,
|
||||
) {
|
||||
}
|
||||
|
||||
fn remove_stale_output(
|
||||
&self,
|
||||
_db: &dyn Database,
|
||||
_executor: DatabaseKeyIndex,
|
||||
_stale_output_key: crate::Id,
|
||||
_provisional: bool,
|
||||
) {
|
||||
}
|
||||
|
||||
fn fmt_index(&self, index: crate::Id, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
fmt_index(A::DEBUG_NAME, index, fmt)
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::any::Any;
|
||||
use std::fmt::Debug;
|
||||
|
||||
use super::Accumulator;
|
||||
use crate::accumulator::Accumulator;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub(crate) struct Accumulated<A: Accumulator> {
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
use std::{
|
||||
ops,
|
||||
sync::atomic::{AtomicBool, Ordering},
|
||||
};
|
||||
use std::ops;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
|
||||
use rustc_hash::FxHashMap;
|
||||
|
||||
use crate::accumulator::accumulated::Accumulated;
|
||||
use crate::accumulator::{Accumulator, AnyAccumulated};
|
||||
use crate::IngredientIndex;
|
||||
|
||||
use super::{accumulated::Accumulated, Accumulator, AnyAccumulated};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct AccumulatedMap {
|
||||
map: FxHashMap<IngredientIndex, Box<dyn AnyAccumulated>>,
|
||||
|
|
|
@ -2,21 +2,17 @@ use std::ops::Not;
|
|||
use std::sync::atomic::AtomicBool;
|
||||
use std::{mem, ops};
|
||||
|
||||
use super::zalsa_local::{QueryEdges, QueryOrigin, QueryRevisions};
|
||||
use crate::accumulator::accumulated_map::AtomicInputAccumulatedValues;
|
||||
use crate::runtime::Stamp;
|
||||
use crate::tracked_struct::{DisambiguatorMap, IdentityHash, IdentityMap};
|
||||
use crate::zalsa_local::QueryEdge;
|
||||
use crate::{
|
||||
accumulator::accumulated_map::{AccumulatedMap, InputAccumulatedValues},
|
||||
cycle::CycleHeads,
|
||||
durability::Durability,
|
||||
hash::FxIndexSet,
|
||||
key::DatabaseKeyIndex,
|
||||
tracked_struct::Disambiguator,
|
||||
Revision,
|
||||
use crate::accumulator::accumulated_map::{
|
||||
AccumulatedMap, AtomicInputAccumulatedValues, InputAccumulatedValues,
|
||||
};
|
||||
use crate::{Accumulator, IngredientIndex};
|
||||
use crate::cycle::CycleHeads;
|
||||
use crate::durability::Durability;
|
||||
use crate::hash::FxIndexSet;
|
||||
use crate::key::DatabaseKeyIndex;
|
||||
use crate::runtime::Stamp;
|
||||
use crate::tracked_struct::{Disambiguator, DisambiguatorMap, IdentityHash, IdentityMap};
|
||||
use crate::zalsa_local::{QueryEdge, QueryEdges, QueryOrigin, QueryRevisions};
|
||||
use crate::{Accumulator, IngredientIndex, Revision};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct ActiveQuery {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use std::{cell::Cell, ptr::NonNull};
|
||||
use std::cell::Cell;
|
||||
use std::ptr::NonNull;
|
||||
|
||||
use crate::Database;
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
use std::{
|
||||
fmt,
|
||||
panic::{self, UnwindSafe},
|
||||
};
|
||||
use std::fmt;
|
||||
use std::panic::{self, UnwindSafe};
|
||||
|
||||
/// A panic payload indicating that execution of a salsa query was cancelled.
|
||||
///
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
use std::{any::Any, borrow::Cow};
|
||||
use std::any::Any;
|
||||
use std::borrow::Cow;
|
||||
|
||||
use crate::{
|
||||
zalsa::{IngredientIndex, ZalsaDatabase},
|
||||
Durability, Event, Revision,
|
||||
};
|
||||
use crate::zalsa::{IngredientIndex, ZalsaDatabase};
|
||||
use crate::{Durability, Event, Revision};
|
||||
|
||||
/// The trait implemented by all Salsa databases.
|
||||
/// You can create your own subtraits of this trait using the `#[salsa::db]`(`crate::db`) procedural macro.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::{storage::HasStorage, Database, Event, Storage};
|
||||
use crate::storage::HasStorage;
|
||||
use crate::{Database, Event, Storage};
|
||||
|
||||
/// Default database implementation that you can use if you don't
|
||||
/// require any custom user data.
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use std::thread::ThreadId;
|
||||
|
||||
use crate::{key::DatabaseKeyIndex, Id, Revision};
|
||||
use crate::key::DatabaseKeyIndex;
|
||||
use crate::{Id, Revision};
|
||||
|
||||
/// The `Event` struct identifies various notable things that can
|
||||
/// occur during salsa execution. Instances of this struct are given
|
||||
|
|
|
@ -1,26 +1,23 @@
|
|||
use std::{any::Any, fmt, ptr::NonNull};
|
||||
|
||||
use crate::{
|
||||
accumulator::accumulated_map::{AccumulatedMap, InputAccumulatedValues},
|
||||
cycle::{CycleRecoveryAction, CycleRecoveryStrategy},
|
||||
ingredient::fmt_index,
|
||||
key::DatabaseKeyIndex,
|
||||
plumbing::MemoIngredientMap,
|
||||
salsa_struct::SalsaStructInDb,
|
||||
table::sync::ClaimResult,
|
||||
table::Table,
|
||||
views::DatabaseDownCaster,
|
||||
zalsa::{IngredientIndex, MemoIngredientIndex, Zalsa},
|
||||
zalsa_local::QueryOrigin,
|
||||
Database, Id, Revision,
|
||||
};
|
||||
|
||||
use self::delete::DeletedEntries;
|
||||
|
||||
use super::ingredient::Ingredient;
|
||||
use std::any::Any;
|
||||
use std::fmt;
|
||||
use std::ptr::NonNull;
|
||||
|
||||
pub(crate) use maybe_changed_after::VerifyResult;
|
||||
|
||||
use crate::accumulator::accumulated_map::{AccumulatedMap, InputAccumulatedValues};
|
||||
use crate::cycle::{CycleRecoveryAction, CycleRecoveryStrategy};
|
||||
use crate::function::delete::DeletedEntries;
|
||||
use crate::ingredient::{fmt_index, Ingredient};
|
||||
use crate::key::DatabaseKeyIndex;
|
||||
use crate::plumbing::MemoIngredientMap;
|
||||
use crate::salsa_struct::SalsaStructInDb;
|
||||
use crate::table::sync::ClaimResult;
|
||||
use crate::table::Table;
|
||||
use crate::views::DatabaseDownCaster;
|
||||
use crate::zalsa::{IngredientIndex, MemoIngredientIndex, Zalsa};
|
||||
use crate::zalsa_local::QueryOrigin;
|
||||
use crate::{Database, Id, Revision};
|
||||
|
||||
mod accumulated;
|
||||
mod backdate;
|
||||
mod delete;
|
||||
|
@ -312,6 +309,10 @@ where
|
|||
C::DEBUG_NAME
|
||||
}
|
||||
|
||||
fn cycle_recovery_strategy(&self) -> CycleRecoveryStrategy {
|
||||
C::CYCLE_STRATEGY
|
||||
}
|
||||
|
||||
fn accumulated<'db>(
|
||||
&'db self,
|
||||
db: &'db dyn Database,
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
use super::{Configuration, IngredientImpl};
|
||||
use crate::accumulator::accumulated_map::InputAccumulatedValues;
|
||||
use crate::accumulator::accumulated_map::{AccumulatedMap, InputAccumulatedValues};
|
||||
use crate::accumulator::{self};
|
||||
use crate::function::{Configuration, IngredientImpl};
|
||||
use crate::hash::FxHashSet;
|
||||
use crate::zalsa::ZalsaDatabase;
|
||||
use crate::zalsa_local::QueryOrigin;
|
||||
use crate::{
|
||||
accumulator::{self, accumulated_map::AccumulatedMap},
|
||||
hash::FxHashSet,
|
||||
zalsa::ZalsaDatabase,
|
||||
AsDynDatabase, DatabaseKeyIndex, Id,
|
||||
};
|
||||
use crate::{AsDynDatabase, DatabaseKeyIndex, Id};
|
||||
|
||||
impl<C> IngredientImpl<C>
|
||||
where
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::function::memo::Memo;
|
||||
use crate::function::{Configuration, IngredientImpl};
|
||||
use crate::zalsa_local::QueryRevisions;
|
||||
|
||||
use super::{memo::Memo, Configuration, IngredientImpl};
|
||||
|
||||
impl<C> IngredientImpl<C>
|
||||
where
|
||||
C: Configuration,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::ptr::NonNull;
|
||||
|
||||
use super::memo::Memo;
|
||||
use super::Configuration;
|
||||
use crate::function::memo::Memo;
|
||||
use crate::function::Configuration;
|
||||
|
||||
/// Stores the list of memos that have been deleted so they can be freed
|
||||
/// once the next revision starts. See the comment on the field
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
use super::{memo::Memo, Configuration, IngredientImpl};
|
||||
use crate::{
|
||||
hash::FxHashSet, zalsa::Zalsa, zalsa_local::QueryRevisions, AsDynDatabase as _, Database,
|
||||
DatabaseKeyIndex, Event, EventKind,
|
||||
};
|
||||
use crate::function::memo::Memo;
|
||||
use crate::function::{Configuration, IngredientImpl};
|
||||
use crate::hash::FxHashSet;
|
||||
use crate::zalsa::Zalsa;
|
||||
use crate::zalsa_local::QueryRevisions;
|
||||
use crate::{AsDynDatabase as _, Database, DatabaseKeyIndex, Event, EventKind};
|
||||
|
||||
impl<C> IngredientImpl<C>
|
||||
where
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
use crate::{
|
||||
cycle::{CycleRecoveryStrategy, MAX_ITERATIONS},
|
||||
zalsa::ZalsaDatabase,
|
||||
zalsa_local::ActiveQueryGuard,
|
||||
Database, Event, EventKind,
|
||||
};
|
||||
|
||||
use super::{memo::Memo, Configuration, IngredientImpl};
|
||||
use crate::cycle::{CycleRecoveryStrategy, MAX_ITERATIONS};
|
||||
use crate::function::memo::Memo;
|
||||
use crate::function::{Configuration, IngredientImpl};
|
||||
use crate::zalsa::ZalsaDatabase;
|
||||
use crate::zalsa_local::ActiveQueryGuard;
|
||||
use crate::{Database, Event, EventKind};
|
||||
|
||||
impl<C> IngredientImpl<C>
|
||||
where
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
use super::{memo::Memo, Configuration, IngredientImpl, VerifyResult};
|
||||
use crate::zalsa::MemoIngredientIndex;
|
||||
use crate::{
|
||||
accumulator::accumulated_map::InputAccumulatedValues,
|
||||
runtime::StampedValue,
|
||||
table::sync::ClaimResult,
|
||||
zalsa::{Zalsa, ZalsaDatabase},
|
||||
zalsa_local::QueryRevisions,
|
||||
AsDynDatabase as _, Id,
|
||||
};
|
||||
use crate::accumulator::accumulated_map::InputAccumulatedValues;
|
||||
use crate::function::memo::Memo;
|
||||
use crate::function::{Configuration, IngredientImpl, VerifyResult};
|
||||
use crate::runtime::StampedValue;
|
||||
use crate::table::sync::ClaimResult;
|
||||
use crate::zalsa::{MemoIngredientIndex, Zalsa, ZalsaDatabase};
|
||||
use crate::zalsa_local::QueryRevisions;
|
||||
use crate::{AsDynDatabase as _, Id};
|
||||
|
||||
impl<C> IngredientImpl<C>
|
||||
where
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use crate::{zalsa::Zalsa, zalsa_local::QueryOrigin, Id};
|
||||
|
||||
use super::{Configuration, IngredientImpl};
|
||||
use crate::function::{Configuration, IngredientImpl};
|
||||
use crate::zalsa::Zalsa;
|
||||
use crate::zalsa_local::QueryOrigin;
|
||||
use crate::Id;
|
||||
|
||||
impl<C> IngredientImpl<C>
|
||||
where
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
use std::num::NonZeroUsize;
|
||||
|
||||
use crate::{hash::FxLinkedHashSet, Id};
|
||||
|
||||
use parking_lot::Mutex;
|
||||
|
||||
use crate::hash::FxLinkedHashSet;
|
||||
use crate::Id;
|
||||
|
||||
pub(super) struct Lru {
|
||||
capacity: Option<NonZeroUsize>,
|
||||
set: Mutex<FxLinkedHashSet<Id>>,
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
use crate::{
|
||||
accumulator::accumulated_map::InputAccumulatedValues,
|
||||
cycle::{CycleHeads, CycleRecoveryStrategy},
|
||||
key::DatabaseKeyIndex,
|
||||
table::sync::ClaimResult,
|
||||
zalsa::{MemoIngredientIndex, Zalsa, ZalsaDatabase},
|
||||
zalsa_local::{ActiveQueryGuard, QueryEdge, QueryOrigin},
|
||||
AsDynDatabase as _, Id, Revision,
|
||||
};
|
||||
use std::sync::atomic::Ordering;
|
||||
|
||||
use super::{memo::Memo, Configuration, IngredientImpl};
|
||||
use crate::accumulator::accumulated_map::InputAccumulatedValues;
|
||||
use crate::cycle::{CycleHeads, CycleRecoveryStrategy};
|
||||
use crate::function::memo::Memo;
|
||||
use crate::function::{Configuration, IngredientImpl};
|
||||
use crate::key::DatabaseKeyIndex;
|
||||
use crate::table::sync::ClaimResult;
|
||||
use crate::zalsa::{MemoIngredientIndex, Zalsa, ZalsaDatabase};
|
||||
use crate::zalsa_local::{ActiveQueryGuard, QueryEdge, QueryOrigin};
|
||||
use crate::{AsDynDatabase as _, Id, Revision};
|
||||
|
||||
/// Result of memo validation.
|
||||
pub enum VerifyResult {
|
||||
|
|
|
@ -1,25 +1,19 @@
|
|||
#![allow(clippy::undocumented_unsafe_blocks)] // TODO(#697) document safety
|
||||
|
||||
use std::any::Any;
|
||||
use std::fmt::Debug;
|
||||
use std::fmt::Formatter;
|
||||
use std::fmt::{Debug, Formatter};
|
||||
use std::ptr::NonNull;
|
||||
use std::sync::atomic::Ordering;
|
||||
|
||||
use crate::accumulator::accumulated_map::InputAccumulatedValues;
|
||||
use crate::cycle::{CycleHeads, CycleRecoveryStrategy, EMPTY_CYCLE_HEADS};
|
||||
use crate::function::{Configuration, IngredientImpl};
|
||||
use crate::key::DatabaseKeyIndex;
|
||||
use crate::revision::AtomicRevision;
|
||||
use crate::table::memo::MemoTable;
|
||||
use crate::zalsa::MemoIngredientIndex;
|
||||
use crate::zalsa_local::QueryOrigin;
|
||||
use crate::{
|
||||
cycle::{CycleHeads, CycleRecoveryStrategy, EMPTY_CYCLE_HEADS},
|
||||
key::DatabaseKeyIndex,
|
||||
zalsa::Zalsa,
|
||||
zalsa_local::QueryRevisions,
|
||||
Event, EventKind, Id, Revision,
|
||||
};
|
||||
|
||||
use super::{Configuration, IngredientImpl};
|
||||
use crate::zalsa::{MemoIngredientIndex, Zalsa};
|
||||
use crate::zalsa_local::{QueryOrigin, QueryRevisions};
|
||||
use crate::{Event, EventKind, Id, Revision};
|
||||
|
||||
impl<C: Configuration> IngredientImpl<C> {
|
||||
/// Memos have to be stored internally using `'static` as the database lifetime.
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
use std::sync::atomic::AtomicBool;
|
||||
|
||||
use crate::{
|
||||
accumulator::accumulated_map::InputAccumulatedValues,
|
||||
revision::AtomicRevision,
|
||||
tracked_struct::TrackedStructInDb,
|
||||
zalsa::ZalsaDatabase,
|
||||
zalsa_local::{QueryOrigin, QueryRevisions},
|
||||
AsDynDatabase as _, Database, DatabaseKeyIndex, Id,
|
||||
};
|
||||
|
||||
use super::{memo::Memo, Configuration, IngredientImpl};
|
||||
use crate::accumulator::accumulated_map::InputAccumulatedValues;
|
||||
use crate::function::memo::Memo;
|
||||
use crate::function::{Configuration, IngredientImpl};
|
||||
use crate::revision::AtomicRevision;
|
||||
use crate::tracked_struct::TrackedStructInDb;
|
||||
use crate::zalsa::ZalsaDatabase;
|
||||
use crate::zalsa_local::{QueryOrigin, QueryRevisions};
|
||||
use crate::{AsDynDatabase as _, Database, DatabaseKeyIndex, Id};
|
||||
|
||||
impl<C> IngredientImpl<C>
|
||||
where
|
||||
|
@ -111,9 +109,9 @@ where
|
|||
/// and `key` is a value that was specified by `executor`.
|
||||
/// Marks `key` as valid in the current revision since if `executor` had re-executed,
|
||||
/// it would have specified `key` again.
|
||||
pub(super) fn validate_specified_value<Db: ?Sized + Database>(
|
||||
pub(super) fn validate_specified_value(
|
||||
&self,
|
||||
db: &Db,
|
||||
db: &dyn Database,
|
||||
executor: DatabaseKeyIndex,
|
||||
key: Id,
|
||||
) {
|
||||
|
|
|
@ -1,19 +1,14 @@
|
|||
use std::{
|
||||
any::{Any, TypeId},
|
||||
fmt,
|
||||
};
|
||||
use std::any::{Any, TypeId};
|
||||
use std::fmt;
|
||||
|
||||
use crate::{
|
||||
accumulator::accumulated_map::{AccumulatedMap, InputAccumulatedValues},
|
||||
function::VerifyResult,
|
||||
plumbing::IngredientIndices,
|
||||
table::Table,
|
||||
zalsa::{transmute_data_mut_ptr, transmute_data_ptr, IngredientIndex, Zalsa},
|
||||
zalsa_local::QueryOrigin,
|
||||
Database, DatabaseKeyIndex, Id,
|
||||
};
|
||||
|
||||
use super::Revision;
|
||||
use crate::accumulator::accumulated_map::{AccumulatedMap, InputAccumulatedValues};
|
||||
use crate::cycle::CycleRecoveryStrategy;
|
||||
use crate::function::VerifyResult;
|
||||
use crate::plumbing::IngredientIndices;
|
||||
use crate::table::Table;
|
||||
use crate::zalsa::{transmute_data_mut_ptr, transmute_data_ptr, IngredientIndex, Zalsa};
|
||||
use crate::zalsa_local::QueryOrigin;
|
||||
use crate::{Database, DatabaseKeyIndex, Id, Revision};
|
||||
|
||||
/// A "jar" is a group of ingredients that are added atomically.
|
||||
/// Each type implementing jar can be added to the database at most once.
|
||||
|
@ -66,29 +61,19 @@ pub trait Ingredient: Any + std::fmt::Debug + Send + Sync {
|
|||
///
|
||||
/// In the case of nested cycles, we are not asking here whether the value is provisional due
|
||||
/// to the outer cycle being unresolved, only whether its own cycle remains provisional.
|
||||
fn is_provisional_cycle_head<'db>(&'db self, db: &'db dyn Database, input: Id) -> bool;
|
||||
fn is_provisional_cycle_head<'db>(&'db self, db: &'db dyn Database, input: Id) -> bool {
|
||||
_ = (db, input);
|
||||
false
|
||||
}
|
||||
|
||||
/// Invoked when the current thread needs to wait for a result for the given `key_index`.
|
||||
///
|
||||
/// A return value of `true` indicates that a result is now available. A return value of
|
||||
/// `false` means that a cycle was encountered; the waited-on query is either already claimed
|
||||
/// by the current thread, or by a thread waiting on the current thread.
|
||||
fn wait_for(&self, db: &dyn Database, key_index: Id) -> bool;
|
||||
|
||||
/// What were the inputs (if any) that were used to create the value at `key_index`.
|
||||
fn origin(&self, db: &dyn Database, key_index: Id) -> Option<QueryOrigin>;
|
||||
|
||||
/// What values were accumulated during the creation of the value at `key_index`
|
||||
/// (if any).
|
||||
///
|
||||
/// In practice, returns `Some` only for tracked function ingredients.
|
||||
fn accumulated<'db>(
|
||||
&'db self,
|
||||
db: &'db dyn Database,
|
||||
key_index: Id,
|
||||
) -> (Option<&'db AccumulatedMap>, InputAccumulatedValues) {
|
||||
fn wait_for(&self, db: &dyn Database, key_index: Id) -> bool {
|
||||
_ = (db, key_index);
|
||||
(None, InputAccumulatedValues::Any)
|
||||
true
|
||||
}
|
||||
|
||||
/// Invoked when the value `output_key` should be marked as valid in the current revision.
|
||||
|
@ -99,7 +84,10 @@ pub trait Ingredient: Any + std::fmt::Debug + Send + Sync {
|
|||
db: &'db dyn Database,
|
||||
executor: DatabaseKeyIndex,
|
||||
output_key: crate::Id,
|
||||
);
|
||||
) {
|
||||
let _ = (db, executor, output_key);
|
||||
unreachable!("only tracked struct and function ingredients can have validatable outputs")
|
||||
}
|
||||
|
||||
/// Invoked when the value `stale_output` was output by `executor` in a previous
|
||||
/// revision, but was NOT output in the current revision.
|
||||
|
@ -111,7 +99,10 @@ pub trait Ingredient: Any + std::fmt::Debug + Send + Sync {
|
|||
executor: DatabaseKeyIndex,
|
||||
stale_output_key: Id,
|
||||
provisional: bool,
|
||||
);
|
||||
) {
|
||||
let _ = (db, executor, stale_output_key, provisional);
|
||||
unreachable!("only tracked struct ingredients can have stale outputs")
|
||||
}
|
||||
|
||||
/// Returns the [`IngredientIndex`] of this ingredient.
|
||||
fn ingredient_index(&self) -> IngredientIndex;
|
||||
|
@ -142,6 +133,31 @@ pub trait Ingredient: Any + std::fmt::Debug + Send + Sync {
|
|||
}
|
||||
|
||||
fn fmt_index(&self, index: crate::Id, fmt: &mut fmt::Formatter<'_>) -> fmt::Result;
|
||||
// Function ingredient methods
|
||||
|
||||
/// If this ingredient is a participant in a cycle, what is its cycle recovery strategy?
|
||||
/// (Really only relevant to [`crate::function::FunctionIngredient`],
|
||||
/// since only function ingredients push themselves onto the active query stack.)
|
||||
fn cycle_recovery_strategy(&self) -> CycleRecoveryStrategy {
|
||||
unreachable!("only function ingredients can be part of a cycle")
|
||||
}
|
||||
|
||||
/// What were the inputs (if any) that were used to create the value at `key_index`.
|
||||
fn origin(&self, db: &dyn Database, key_index: Id) -> Option<QueryOrigin> {
|
||||
let _ = (db, key_index);
|
||||
unreachable!("only function ingredients have origins")
|
||||
}
|
||||
|
||||
/// What values were accumulated during the creation of the value at `key_index`
|
||||
/// (if any).
|
||||
fn accumulated<'db>(
|
||||
&'db self,
|
||||
db: &'db dyn Database,
|
||||
key_index: Id,
|
||||
) -> (Option<&'db AccumulatedMap>, InputAccumulatedValues) {
|
||||
let _ = (db, key_index);
|
||||
(None, InputAccumulatedValues::Empty)
|
||||
}
|
||||
}
|
||||
|
||||
impl dyn Ingredient {
|
||||
|
|
69
src/input.rs
69
src/input.rs
|
@ -1,8 +1,6 @@
|
|||
use std::{
|
||||
any::{Any, TypeId},
|
||||
fmt,
|
||||
ops::DerefMut,
|
||||
};
|
||||
use std::any::{Any, TypeId};
|
||||
use std::fmt;
|
||||
use std::ops::DerefMut;
|
||||
|
||||
pub mod input_field;
|
||||
pub mod setter;
|
||||
|
@ -10,18 +8,17 @@ pub mod singleton;
|
|||
|
||||
use input_field::FieldIngredientImpl;
|
||||
|
||||
use crate::{
|
||||
function::VerifyResult,
|
||||
id::{AsId, FromIdWithDb},
|
||||
ingredient::{fmt_index, Ingredient},
|
||||
input::singleton::{Singleton, SingletonChoice},
|
||||
key::DatabaseKeyIndex,
|
||||
plumbing::{Jar, Stamp},
|
||||
table::{memo::MemoTable, sync::SyncTable, Slot, Table},
|
||||
zalsa::{IngredientIndex, Zalsa},
|
||||
zalsa_local::QueryOrigin,
|
||||
Database, Durability, Id, Revision, Runtime,
|
||||
};
|
||||
use crate::function::VerifyResult;
|
||||
use crate::id::{AsId, FromIdWithDb};
|
||||
use crate::ingredient::{fmt_index, Ingredient};
|
||||
use crate::input::singleton::{Singleton, SingletonChoice};
|
||||
use crate::key::DatabaseKeyIndex;
|
||||
use crate::plumbing::{Jar, Stamp};
|
||||
use crate::table::memo::MemoTable;
|
||||
use crate::table::sync::SyncTable;
|
||||
use crate::table::{Slot, Table};
|
||||
use crate::zalsa::{IngredientIndex, Zalsa};
|
||||
use crate::{Database, Durability, Id, Revision, Runtime};
|
||||
|
||||
pub trait Configuration: Any {
|
||||
const DEBUG_NAME: &'static str;
|
||||
|
@ -215,44 +212,6 @@ impl<C: Configuration> Ingredient for IngredientImpl<C> {
|
|||
// Their *fields* are stored in function ingredients elsewhere.
|
||||
VerifyResult::unchanged()
|
||||
}
|
||||
|
||||
fn is_provisional_cycle_head<'db>(&'db self, _db: &'db dyn Database, _input: Id) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn wait_for(&self, _db: &dyn Database, _key_index: Id) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn origin(&self, _db: &dyn Database, _key_index: Id) -> Option<QueryOrigin> {
|
||||
None
|
||||
}
|
||||
|
||||
fn mark_validated_output(
|
||||
&self,
|
||||
_db: &dyn Database,
|
||||
executor: DatabaseKeyIndex,
|
||||
output_key: Id,
|
||||
) {
|
||||
unreachable!(
|
||||
"mark_validated_output({:?}, {:?}): input cannot be the output of a tracked function",
|
||||
executor, output_key
|
||||
);
|
||||
}
|
||||
|
||||
fn remove_stale_output(
|
||||
&self,
|
||||
_db: &dyn Database,
|
||||
executor: DatabaseKeyIndex,
|
||||
stale_output_key: Id,
|
||||
_provisional: bool,
|
||||
) {
|
||||
unreachable!(
|
||||
"remove_stale_output({:?}, {:?}): input cannot be the output of a tracked function",
|
||||
executor, stale_output_key
|
||||
);
|
||||
}
|
||||
|
||||
fn fmt_index(&self, index: Id, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
fmt_index(C::DEBUG_NAME, index, fmt)
|
||||
}
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
use crate::function::VerifyResult;
|
||||
use crate::ingredient::{fmt_index, Ingredient};
|
||||
use crate::input::Configuration;
|
||||
use crate::zalsa::IngredientIndex;
|
||||
use crate::zalsa_local::QueryOrigin;
|
||||
use crate::{Database, DatabaseKeyIndex, Id, Revision};
|
||||
use std::fmt;
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use super::{IngredientImpl, Value};
|
||||
use crate::function::VerifyResult;
|
||||
use crate::ingredient::{fmt_index, Ingredient};
|
||||
use crate::input::{Configuration, IngredientImpl, Value};
|
||||
use crate::zalsa::IngredientIndex;
|
||||
use crate::{Database, Id, Revision};
|
||||
|
||||
/// Ingredient used to represent the fields of a `#[salsa::input]`.
|
||||
///
|
||||
|
@ -64,27 +62,6 @@ where
|
|||
true
|
||||
}
|
||||
|
||||
fn origin(&self, _db: &dyn Database, _key_index: Id) -> Option<QueryOrigin> {
|
||||
None
|
||||
}
|
||||
|
||||
fn mark_validated_output(
|
||||
&self,
|
||||
_db: &dyn Database,
|
||||
_executor: DatabaseKeyIndex,
|
||||
_output_key: Id,
|
||||
) {
|
||||
}
|
||||
|
||||
fn remove_stale_output(
|
||||
&self,
|
||||
_db: &dyn Database,
|
||||
_executor: DatabaseKeyIndex,
|
||||
_stale_output_key: Id,
|
||||
_provisional: bool,
|
||||
) {
|
||||
}
|
||||
|
||||
fn fmt_index(&self, index: crate::Id, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
fmt_index(C::FIELD_DEBUG_NAMES[self.field_index], index, fmt)
|
||||
}
|
||||
|
|
|
@ -1,18 +1,5 @@
|
|||
#![allow(clippy::undocumented_unsafe_blocks)] // TODO(#697) document safety
|
||||
|
||||
use dashmap::SharedValue;
|
||||
|
||||
use crate::durability::Durability;
|
||||
use crate::function::VerifyResult;
|
||||
use crate::ingredient::fmt_index;
|
||||
use crate::plumbing::{IngredientIndices, Jar};
|
||||
use crate::revision::AtomicRevision;
|
||||
use crate::table::memo::MemoTable;
|
||||
use crate::table::sync::SyncTable;
|
||||
use crate::table::Slot;
|
||||
use crate::zalsa::{IngredientIndex, Zalsa};
|
||||
use crate::zalsa_local::QueryOrigin;
|
||||
use crate::{Database, DatabaseKeyIndex, Event, EventKind, Id};
|
||||
use std::any::TypeId;
|
||||
use std::fmt;
|
||||
use std::hash::{BuildHasher, Hash, Hasher};
|
||||
|
@ -20,9 +7,19 @@ use std::marker::PhantomData;
|
|||
use std::path::{Path, PathBuf};
|
||||
use std::sync::atomic::{AtomicU8, Ordering};
|
||||
|
||||
use super::hash::FxDashMap;
|
||||
use super::ingredient::Ingredient;
|
||||
use super::Revision;
|
||||
use dashmap::SharedValue;
|
||||
|
||||
use crate::durability::Durability;
|
||||
use crate::function::VerifyResult;
|
||||
use crate::hash::FxDashMap;
|
||||
use crate::ingredient::{fmt_index, Ingredient};
|
||||
use crate::plumbing::{IngredientIndices, Jar};
|
||||
use crate::revision::AtomicRevision;
|
||||
use crate::table::memo::MemoTable;
|
||||
use crate::table::sync::SyncTable;
|
||||
use crate::table::Slot;
|
||||
use crate::zalsa::{IngredientIndex, Zalsa};
|
||||
use crate::{Database, DatabaseKeyIndex, Event, EventKind, Id, Revision};
|
||||
|
||||
pub trait Configuration: Sized + 'static {
|
||||
const DEBUG_NAME: &'static str;
|
||||
|
@ -404,50 +401,6 @@ where
|
|||
VerifyResult::unchanged()
|
||||
}
|
||||
|
||||
fn is_provisional_cycle_head<'db>(&'db self, _db: &'db dyn Database, _input: Id) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn wait_for(&self, _db: &dyn Database, _key_index: Id) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn origin(&self, _db: &dyn Database, _key_index: crate::Id) -> Option<QueryOrigin> {
|
||||
None
|
||||
}
|
||||
|
||||
fn mark_validated_output(
|
||||
&self,
|
||||
_db: &dyn Database,
|
||||
executor: DatabaseKeyIndex,
|
||||
output_key: crate::Id,
|
||||
) {
|
||||
unreachable!(
|
||||
"mark_validated_output({:?}, {:?}): input cannot be the output of a tracked function",
|
||||
executor, output_key
|
||||
);
|
||||
}
|
||||
|
||||
fn remove_stale_output(
|
||||
&self,
|
||||
_db: &dyn Database,
|
||||
executor: DatabaseKeyIndex,
|
||||
stale_output_key: crate::Id,
|
||||
_provisional: bool,
|
||||
) {
|
||||
unreachable!(
|
||||
"remove_stale_output({:?}, {:?}): interned ids are not outputs",
|
||||
executor, stale_output_key
|
||||
);
|
||||
}
|
||||
|
||||
// Interned ingredients do not, normally, get deleted except when they are "reset" en masse.
|
||||
// There ARE methods (e.g., `clear_deleted_entries` and `remove`) for deleting individual
|
||||
// items, but those are only used for tracked struct ingredients.
|
||||
fn requires_reset_for_new_revision(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn fmt_index(&self, index: crate::Id, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
fmt_index(C::DEBUG_NAME, index, fmt)
|
||||
}
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
use core::fmt;
|
||||
|
||||
use crate::{
|
||||
function::VerifyResult,
|
||||
zalsa::{IngredientIndex, Zalsa},
|
||||
Database, Id,
|
||||
};
|
||||
use crate::function::VerifyResult;
|
||||
use crate::zalsa::{IngredientIndex, Zalsa};
|
||||
use crate::{Database, Id};
|
||||
|
||||
// ANCHOR: DatabaseKeyIndex
|
||||
/// An integer that uniquely identifies a particular query instance within the
|
||||
|
|
110
src/lib.rs
110
src/lib.rs
|
@ -33,15 +33,18 @@ mod views;
|
|||
mod zalsa;
|
||||
mod zalsa_local;
|
||||
|
||||
#[cfg(feature = "rayon")]
|
||||
pub use parallel::{join, par_map, scope, Scope};
|
||||
#[cfg(feature = "macros")]
|
||||
pub use salsa_macros::{accumulator, db, input, interned, tracked, Supertype, Update};
|
||||
|
||||
pub use self::accumulator::Accumulator;
|
||||
pub use self::cancelled::Cancelled;
|
||||
pub use self::cycle::CycleRecoveryAction;
|
||||
pub use self::database::AsDynDatabase;
|
||||
pub use self::database::Database;
|
||||
pub use self::database::{AsDynDatabase, Database};
|
||||
pub use self::database_impl::DatabaseImpl;
|
||||
pub use self::durability::Durability;
|
||||
pub use self::event::Event;
|
||||
pub use self::event::EventKind;
|
||||
pub use self::event::{Event, EventKind};
|
||||
pub use self::id::Id;
|
||||
pub use self::input::setter::Setter;
|
||||
pub use self::key::DatabaseKeyIndex;
|
||||
|
@ -51,15 +54,9 @@ pub use self::storage::Storage;
|
|||
pub use self::update::Update;
|
||||
pub use self::zalsa::IngredientIndex;
|
||||
pub use crate::attach::with_attached_database;
|
||||
#[cfg(feature = "rayon")]
|
||||
pub use parallel::{join, par_map, scope, Scope};
|
||||
#[cfg(feature = "macros")]
|
||||
pub use salsa_macros::{accumulator, db, input, interned, tracked, Supertype, Update};
|
||||
|
||||
pub mod prelude {
|
||||
pub use crate::Accumulator;
|
||||
pub use crate::Database;
|
||||
pub use crate::Setter;
|
||||
pub use crate::{Accumulator, Database, Setter};
|
||||
}
|
||||
|
||||
/// Internal names used by salsa macros.
|
||||
|
@ -71,97 +68,60 @@ pub mod plumbing {
|
|||
pub use std::any::TypeId;
|
||||
pub use std::option::Option::{self, None, Some};
|
||||
|
||||
pub use salsa_macro_rules::{
|
||||
macro_if, maybe_backdate, maybe_clone, maybe_cloned_ty, maybe_default, maybe_default_tt,
|
||||
setup_accumulator_impl, setup_input_struct, setup_interned_struct, setup_method_body,
|
||||
setup_tracked_fn, setup_tracked_struct, unexpected_cycle_initial,
|
||||
unexpected_cycle_recovery,
|
||||
};
|
||||
|
||||
pub use crate::accumulator::Accumulator;
|
||||
pub use crate::array::Array;
|
||||
pub use crate::attach::attach;
|
||||
pub use crate::attach::with_attached_database;
|
||||
pub use crate::cycle::CycleRecoveryAction;
|
||||
pub use crate::cycle::CycleRecoveryStrategy;
|
||||
pub use crate::database::current_revision;
|
||||
pub use crate::database::Database;
|
||||
pub use crate::attach::{attach, with_attached_database};
|
||||
pub use crate::cycle::{CycleRecoveryAction, CycleRecoveryStrategy};
|
||||
pub use crate::database::{current_revision, Database};
|
||||
pub use crate::function::values_equal;
|
||||
pub use crate::id::AsId;
|
||||
pub use crate::id::FromId;
|
||||
pub use crate::id::FromIdWithDb;
|
||||
pub use crate::id::Id;
|
||||
pub use crate::ingredient::Ingredient;
|
||||
pub use crate::ingredient::Jar;
|
||||
pub use crate::id::{AsId, FromId, FromIdWithDb, Id};
|
||||
pub use crate::ingredient::{Ingredient, Jar};
|
||||
pub use crate::key::DatabaseKeyIndex;
|
||||
pub use crate::memo_ingredient_indices::{
|
||||
IngredientIndices, MemoIngredientIndices, MemoIngredientMap, MemoIngredientSingletonIndex,
|
||||
};
|
||||
pub use crate::revision::Revision;
|
||||
pub use crate::runtime::stamp;
|
||||
pub use crate::runtime::Runtime;
|
||||
pub use crate::runtime::Stamp;
|
||||
pub use crate::runtime::StampedValue;
|
||||
pub use crate::runtime::{stamp, Runtime, Stamp, StampedValue};
|
||||
pub use crate::salsa_struct::SalsaStructInDb;
|
||||
pub use crate::storage::HasStorage;
|
||||
pub use crate::storage::Storage;
|
||||
pub use crate::storage::{HasStorage, Storage};
|
||||
pub use crate::tracked_struct::TrackedStructInDb;
|
||||
pub use crate::update::always_update;
|
||||
pub use crate::update::helper::Dispatch as UpdateDispatch;
|
||||
pub use crate::update::helper::Fallback as UpdateFallback;
|
||||
pub use crate::update::Update;
|
||||
pub use crate::zalsa::transmute_data_ptr;
|
||||
pub use crate::zalsa::views;
|
||||
pub use crate::zalsa::IngredientCache;
|
||||
pub use crate::zalsa::IngredientIndex;
|
||||
pub use crate::zalsa::Zalsa;
|
||||
pub use crate::zalsa::ZalsaDatabase;
|
||||
pub use crate::update::helper::{Dispatch as UpdateDispatch, Fallback as UpdateFallback};
|
||||
pub use crate::update::{always_update, Update};
|
||||
pub use crate::zalsa::{
|
||||
transmute_data_ptr, views, IngredientCache, IngredientIndex, Zalsa, ZalsaDatabase,
|
||||
};
|
||||
pub use crate::zalsa_local::ZalsaLocal;
|
||||
|
||||
pub use salsa_macro_rules::macro_if;
|
||||
pub use salsa_macro_rules::maybe_backdate;
|
||||
pub use salsa_macro_rules::maybe_clone;
|
||||
pub use salsa_macro_rules::maybe_cloned_ty;
|
||||
pub use salsa_macro_rules::maybe_default;
|
||||
pub use salsa_macro_rules::maybe_default_tt;
|
||||
pub use salsa_macro_rules::setup_accumulator_impl;
|
||||
pub use salsa_macro_rules::setup_input_struct;
|
||||
pub use salsa_macro_rules::setup_interned_struct;
|
||||
pub use salsa_macro_rules::setup_method_body;
|
||||
pub use salsa_macro_rules::setup_tracked_fn;
|
||||
pub use salsa_macro_rules::setup_tracked_struct;
|
||||
pub use salsa_macro_rules::unexpected_cycle_initial;
|
||||
pub use salsa_macro_rules::unexpected_cycle_recovery;
|
||||
|
||||
pub mod accumulator {
|
||||
pub use crate::accumulator::IngredientImpl;
|
||||
pub use crate::accumulator::JarImpl;
|
||||
pub use crate::accumulator::{IngredientImpl, JarImpl};
|
||||
}
|
||||
|
||||
pub mod input {
|
||||
pub use crate::input::input_field::FieldIngredientImpl;
|
||||
pub use crate::input::setter::SetterImpl;
|
||||
pub use crate::input::singleton::NotSingleton;
|
||||
pub use crate::input::singleton::Singleton;
|
||||
pub use crate::input::Configuration;
|
||||
pub use crate::input::HasBuilder;
|
||||
pub use crate::input::IngredientImpl;
|
||||
pub use crate::input::JarImpl;
|
||||
pub use crate::input::Value;
|
||||
pub use crate::input::singleton::{NotSingleton, Singleton};
|
||||
pub use crate::input::{Configuration, HasBuilder, IngredientImpl, JarImpl, Value};
|
||||
}
|
||||
|
||||
pub mod interned {
|
||||
pub use crate::interned::Configuration;
|
||||
pub use crate::interned::HashEqLike;
|
||||
pub use crate::interned::IngredientImpl;
|
||||
pub use crate::interned::JarImpl;
|
||||
pub use crate::interned::Lookup;
|
||||
pub use crate::interned::Value;
|
||||
pub use crate::interned::{
|
||||
Configuration, HashEqLike, IngredientImpl, JarImpl, Lookup, Value,
|
||||
};
|
||||
}
|
||||
|
||||
pub mod function {
|
||||
pub use crate::function::Configuration;
|
||||
pub use crate::function::IngredientImpl;
|
||||
pub use crate::function::{Configuration, IngredientImpl};
|
||||
}
|
||||
|
||||
pub mod tracked_struct {
|
||||
pub use crate::tracked_struct::tracked_field::FieldIngredientImpl;
|
||||
pub use crate::tracked_struct::Configuration;
|
||||
pub use crate::tracked_struct::IngredientImpl;
|
||||
pub use crate::tracked_struct::JarImpl;
|
||||
pub use crate::tracked_struct::Value;
|
||||
pub use crate::tracked_struct::{Configuration, IngredientImpl, JarImpl, Value};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
use std::{marker::PhantomData, num::NonZeroU32, sync::atomic::AtomicU32};
|
||||
use std::marker::PhantomData;
|
||||
use std::num::NonZeroU32;
|
||||
use std::sync::atomic::AtomicU32;
|
||||
|
||||
/// A type to generate nonces. Store it in a static and each nonce it produces will be unique from other nonces.
|
||||
/// The type parameter `T` just serves to distinguish different kinds of nonces.
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
use std::{
|
||||
sync::atomic::{AtomicBool, Ordering},
|
||||
thread::ThreadId,
|
||||
};
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::thread::ThreadId;
|
||||
|
||||
use parking_lot::Mutex;
|
||||
|
||||
use crate::{
|
||||
durability::Durability, key::DatabaseKeyIndex, table::Table, Cancelled, Database, Event,
|
||||
EventKind, Revision,
|
||||
};
|
||||
|
||||
use self::dependency_graph::DependencyGraph;
|
||||
use crate::durability::Durability;
|
||||
use crate::key::DatabaseKeyIndex;
|
||||
use crate::table::Table;
|
||||
use crate::{Cancelled, Database, Event, EventKind, Revision};
|
||||
|
||||
mod dependency_graph;
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
use std::thread::ThreadId;
|
||||
|
||||
use crate::key::DatabaseKeyIndex;
|
||||
use crate::runtime::WaitResult;
|
||||
use parking_lot::MutexGuard;
|
||||
use rustc_hash::FxHashMap;
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use crate::key::DatabaseKeyIndex;
|
||||
use crate::runtime::WaitResult;
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub(super) struct DependencyGraph {
|
||||
/// A `(K -> V)` pair in this map indicates that the runtime
|
||||
|
@ -127,7 +128,8 @@ impl DependencyGraph {
|
|||
}
|
||||
|
||||
mod edge {
|
||||
use std::{sync::Arc, thread::ThreadId};
|
||||
use std::sync::Arc;
|
||||
use std::thread::ThreadId;
|
||||
|
||||
use parking_lot::MutexGuard;
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
//! Public API facades for the implementation details of [`Zalsa`] and [`ZalsaLocal`].
|
||||
use std::{marker::PhantomData, panic::RefUnwindSafe, sync::Arc};
|
||||
use std::marker::PhantomData;
|
||||
use std::panic::RefUnwindSafe;
|
||||
use std::sync::Arc;
|
||||
|
||||
use parking_lot::{Condvar, Mutex};
|
||||
|
||||
use crate::{
|
||||
zalsa::{Zalsa, ZalsaDatabase},
|
||||
zalsa_local::{self, ZalsaLocal},
|
||||
Database, Event, EventKind,
|
||||
};
|
||||
use crate::zalsa::{Zalsa, ZalsaDatabase};
|
||||
use crate::zalsa_local::{self, ZalsaLocal};
|
||||
use crate::{Database, Event, EventKind};
|
||||
|
||||
/// A handle to non-local database state.
|
||||
pub struct StorageHandle<Db> {
|
||||
|
|
18
src/table.rs
18
src/table.rs
|
@ -1,13 +1,11 @@
|
|||
use std::{
|
||||
alloc::Layout,
|
||||
any::{Any, TypeId},
|
||||
cell::UnsafeCell,
|
||||
marker::PhantomData,
|
||||
mem::{self, MaybeUninit},
|
||||
ptr::{self, NonNull},
|
||||
slice,
|
||||
sync::atomic::{AtomicUsize, Ordering},
|
||||
};
|
||||
use std::alloc::Layout;
|
||||
use std::any::{Any, TypeId};
|
||||
use std::cell::UnsafeCell;
|
||||
use std::marker::PhantomData;
|
||||
use std::mem::{self, MaybeUninit};
|
||||
use std::ptr::{self, NonNull};
|
||||
use std::slice;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
|
||||
use memo::MemoTable;
|
||||
use parking_lot::Mutex;
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
use std::{
|
||||
any::{Any, TypeId},
|
||||
ptr::NonNull,
|
||||
sync::atomic::{AtomicPtr, Ordering},
|
||||
};
|
||||
use std::any::{Any, TypeId};
|
||||
use std::ptr::NonNull;
|
||||
use std::sync::atomic::{AtomicPtr, Ordering};
|
||||
|
||||
use parking_lot::RwLock;
|
||||
use thin_vec::ThinVec;
|
||||
|
||||
use crate::{zalsa::MemoIngredientIndex, zalsa_local::QueryOrigin};
|
||||
use crate::zalsa::MemoIngredientIndex;
|
||||
use crate::zalsa_local::QueryOrigin;
|
||||
|
||||
/// The "memo table" stores the memoized results of tracked function calls.
|
||||
/// Every tracked function must take a salsa struct as its first argument
|
||||
|
|
|
@ -2,14 +2,11 @@ use std::thread::ThreadId;
|
|||
|
||||
use parking_lot::Mutex;
|
||||
|
||||
use crate::{
|
||||
key::DatabaseKeyIndex,
|
||||
runtime::{BlockResult, WaitResult},
|
||||
zalsa::{MemoIngredientIndex, Zalsa},
|
||||
Database,
|
||||
};
|
||||
|
||||
use super::util;
|
||||
use crate::key::DatabaseKeyIndex;
|
||||
use crate::runtime::{BlockResult, WaitResult};
|
||||
use crate::table::util;
|
||||
use crate::zalsa::{MemoIngredientIndex, Zalsa};
|
||||
use crate::Database;
|
||||
|
||||
/// Tracks the keys that are currently being processed; used to coordinate between
|
||||
/// worker threads.
|
||||
|
|
|
@ -1,23 +1,26 @@
|
|||
#![allow(clippy::undocumented_unsafe_blocks)] // TODO(#697) document safety
|
||||
|
||||
use std::{any::TypeId, fmt, hash::Hash, marker::PhantomData, ops::DerefMut};
|
||||
use std::any::TypeId;
|
||||
use std::fmt;
|
||||
use std::hash::Hash;
|
||||
use std::marker::PhantomData;
|
||||
use std::ops::DerefMut;
|
||||
|
||||
use crossbeam_queue::SegQueue;
|
||||
use tracked_field::FieldIngredientImpl;
|
||||
|
||||
use crate::{
|
||||
function::VerifyResult,
|
||||
ingredient::{fmt_index, Ingredient, Jar},
|
||||
key::DatabaseKeyIndex,
|
||||
plumbing::ZalsaLocal,
|
||||
revision::OptionalAtomicRevision,
|
||||
runtime::StampedValue,
|
||||
salsa_struct::SalsaStructInDb,
|
||||
table::{memo::MemoTable, sync::SyncTable, Slot, Table},
|
||||
zalsa::{IngredientIndex, Zalsa},
|
||||
zalsa_local::QueryOrigin,
|
||||
Database, Durability, Event, EventKind, Id, Revision,
|
||||
};
|
||||
use crate::function::VerifyResult;
|
||||
use crate::ingredient::{fmt_index, Ingredient, Jar};
|
||||
use crate::key::DatabaseKeyIndex;
|
||||
use crate::plumbing::ZalsaLocal;
|
||||
use crate::revision::OptionalAtomicRevision;
|
||||
use crate::runtime::StampedValue;
|
||||
use crate::salsa_struct::SalsaStructInDb;
|
||||
use crate::table::memo::MemoTable;
|
||||
use crate::table::sync::SyncTable;
|
||||
use crate::table::{Slot, Table};
|
||||
use crate::zalsa::{IngredientIndex, Zalsa};
|
||||
use crate::{Database, Durability, Event, EventKind, Id, Revision};
|
||||
|
||||
pub mod tracked_field;
|
||||
|
||||
|
@ -755,10 +758,6 @@ where
|
|||
true
|
||||
}
|
||||
|
||||
fn origin(&self, _db: &dyn Database, _key_index: crate::Id) -> Option<QueryOrigin> {
|
||||
None
|
||||
}
|
||||
|
||||
fn mark_validated_output<'db>(
|
||||
&'db self,
|
||||
_db: &'db dyn Database,
|
||||
|
@ -781,7 +780,7 @@ where
|
|||
// `executor` creates a tracked struct `salsa_output_key`,
|
||||
// but it did not in the current revision.
|
||||
// In that case, we can delete `stale_output_key` and any data associated with it.
|
||||
self.delete_entity(db.as_dyn_database(), stale_output_key, provisional);
|
||||
self.delete_entity(db, stale_output_key, provisional);
|
||||
}
|
||||
|
||||
fn fmt_index(&self, index: crate::Id, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
use std::marker::PhantomData;
|
||||
|
||||
use crate::{function::VerifyResult, ingredient::Ingredient, zalsa::IngredientIndex, Database, Id};
|
||||
|
||||
use super::{Configuration, Value};
|
||||
use crate::function::VerifyResult;
|
||||
use crate::ingredient::Ingredient;
|
||||
use crate::tracked_struct::{Configuration, Value};
|
||||
use crate::zalsa::IngredientIndex;
|
||||
use crate::{Database, Id};
|
||||
|
||||
/// Created for each tracked struct.
|
||||
///
|
||||
|
@ -59,41 +61,6 @@ where
|
|||
VerifyResult::changed_if(field_changed_at > revision)
|
||||
}
|
||||
|
||||
fn is_provisional_cycle_head<'db>(&'db self, _db: &'db dyn Database, _input: Id) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn wait_for(&self, _db: &dyn Database, _key_index: Id) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn origin(
|
||||
&self,
|
||||
_db: &dyn Database,
|
||||
_key_index: crate::Id,
|
||||
) -> Option<crate::zalsa_local::QueryOrigin> {
|
||||
None
|
||||
}
|
||||
|
||||
fn mark_validated_output(
|
||||
&self,
|
||||
_db: &dyn Database,
|
||||
_executor: crate::DatabaseKeyIndex,
|
||||
_output_key: crate::Id,
|
||||
) {
|
||||
panic!("tracked field ingredients have no outputs")
|
||||
}
|
||||
|
||||
fn remove_stale_output(
|
||||
&self,
|
||||
_db: &dyn Database,
|
||||
_executor: crate::DatabaseKeyIndex,
|
||||
_stale_output_key: crate::Id,
|
||||
_provisional: bool,
|
||||
) {
|
||||
panic!("tracked field ingredients have no outputs")
|
||||
}
|
||||
|
||||
fn fmt_index(&self, index: crate::Id, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(
|
||||
fmt,
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
#![allow(clippy::undocumented_unsafe_blocks)] // TODO(#697) document safety
|
||||
|
||||
use std::{
|
||||
collections::{BTreeMap, BTreeSet, HashMap, HashSet},
|
||||
hash::{BuildHasher, Hash},
|
||||
marker::PhantomData,
|
||||
path::PathBuf,
|
||||
sync::Arc,
|
||||
};
|
||||
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
|
||||
use std::hash::{BuildHasher, Hash};
|
||||
use std::marker::PhantomData;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
|
||||
#[cfg(feature = "rayon")]
|
||||
use rayon::iter::Either;
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
use parking_lot::{Mutex, RwLock};
|
||||
use portable_atomic::AtomicU64;
|
||||
use rustc_hash::FxHashMap;
|
||||
use std::any::{Any, TypeId};
|
||||
use std::collections::hash_map;
|
||||
use std::marker::PhantomData;
|
||||
|
@ -9,6 +6,10 @@ use std::num::NonZeroU32;
|
|||
use std::panic::RefUnwindSafe;
|
||||
use std::sync::atomic::Ordering;
|
||||
|
||||
use parking_lot::{Mutex, RwLock};
|
||||
use portable_atomic::AtomicU64;
|
||||
use rustc_hash::FxHashMap;
|
||||
|
||||
use crate::ingredient::{Ingredient, Jar};
|
||||
use crate::nonce::{Nonce, NonceGenerator};
|
||||
use crate::runtime::Runtime;
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
use std::cell::RefCell;
|
||||
use std::panic::UnwindSafe;
|
||||
use std::sync::atomic::AtomicBool;
|
||||
|
||||
use rustc_hash::FxHashMap;
|
||||
use tracing::debug;
|
||||
|
||||
|
@ -9,18 +13,10 @@ use crate::cycle::CycleHeads;
|
|||
use crate::durability::Durability;
|
||||
use crate::key::DatabaseKeyIndex;
|
||||
use crate::runtime::{Stamp, StampedValue};
|
||||
use crate::table::PageIndex;
|
||||
use crate::table::Slot;
|
||||
use crate::table::Table;
|
||||
use crate::table::{PageIndex, Slot, Table};
|
||||
use crate::tracked_struct::{Disambiguator, Identity, IdentityHash, IdentityMap};
|
||||
use crate::zalsa::IngredientIndex;
|
||||
use crate::Accumulator;
|
||||
use crate::Cancelled;
|
||||
use crate::Id;
|
||||
use crate::Revision;
|
||||
use std::cell::RefCell;
|
||||
use std::panic::UnwindSafe;
|
||||
use std::sync::atomic::AtomicBool;
|
||||
use crate::{Accumulator, Cancelled, Id, Revision};
|
||||
|
||||
/// State that is specific to a single execution thread.
|
||||
///
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
mod common;
|
||||
use common::{LogDatabase, LoggerDatabase};
|
||||
|
||||
use expect_test::expect;
|
||||
use salsa::{Accumulator, Setter};
|
||||
use test_log::test;
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
mod common;
|
||||
use common::{LogDatabase, LoggerDatabase};
|
||||
|
||||
use expect_test::expect;
|
||||
use salsa::{Accumulator, Setter};
|
||||
use test_log::test;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
mod common;
|
||||
use common::{LogDatabase, LoggerDatabase};
|
||||
|
||||
use expect_test::expect;
|
||||
use salsa::{Accumulator, Setter};
|
||||
use test_log::test;
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
mod common;
|
||||
use common::LogDatabase;
|
||||
|
||||
use expect_test::expect;
|
||||
use salsa::{Accumulator, Setter};
|
||||
use test_log::test;
|
||||
|
|
|
@ -2,7 +2,6 @@ use std::collections::HashSet;
|
|||
|
||||
mod common;
|
||||
use common::{LogDatabase, LoggerDatabase};
|
||||
|
||||
use expect_test::expect;
|
||||
use salsa::{Accumulator, Setter};
|
||||
use test_log::test;
|
||||
|
|
|
@ -2,10 +2,11 @@
|
|||
//!
|
||||
//! This test case is intended to simulate a (very simplified) version of a real dataflow analysis
|
||||
//! using fixpoint iteration.
|
||||
use salsa::{CycleRecoveryAction, Database as Db, Setter};
|
||||
use std::collections::BTreeSet;
|
||||
use std::iter::IntoIterator;
|
||||
|
||||
use salsa::{CycleRecoveryAction, Database as Db, Setter};
|
||||
|
||||
/// A Use of a symbol.
|
||||
#[salsa::input]
|
||||
struct Use {
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
mod common;
|
||||
use common::LogDatabase;
|
||||
|
||||
use expect_test::expect;
|
||||
use salsa::Setter;
|
||||
use test_log::test;
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
mod common;
|
||||
use common::LogDatabase;
|
||||
|
||||
use expect_test::expect;
|
||||
use salsa::Setter;
|
||||
use test_log::test;
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
mod common;
|
||||
use common::LogDatabase;
|
||||
|
||||
use expect_test::expect;
|
||||
use salsa::Setter;
|
||||
use test_log::test;
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
mod common;
|
||||
use common::LogDatabase;
|
||||
|
||||
use expect_test::expect;
|
||||
use salsa::Setter;
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
mod common;
|
||||
use common::LogDatabase;
|
||||
|
||||
use expect_test::expect;
|
||||
use salsa::Setter;
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
mod common;
|
||||
use common::LogDatabase;
|
||||
|
||||
use expect_test::expect;
|
||||
use salsa::Setter;
|
||||
use test_log::test;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
use test_log::test;
|
||||
|
||||
use salsa::plumbing::ZalsaDatabase;
|
||||
use salsa::{Durability, Setter};
|
||||
use test_log::test;
|
||||
|
||||
#[salsa::input]
|
||||
struct MyInput {
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
//! Test that a `tracked` fn on a `salsa::input`
|
||||
//! compiles and executes successfully.
|
||||
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use expect_test::expect;
|
||||
use salsa::plumbing::{AsId, FromId};
|
||||
use std::path::{Path, PathBuf};
|
||||
use test_log::test;
|
||||
|
||||
#[salsa::interned(debug)]
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
//! Test that a `tracked` fn with lru options
|
||||
//! compiles and executes successfully.
|
||||
|
||||
use std::sync::{
|
||||
atomic::{AtomicUsize, Ordering},
|
||||
Arc,
|
||||
};
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::sync::Arc;
|
||||
|
||||
mod common;
|
||||
use common::LogDatabase;
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
//! Test for thread cancellation.
|
||||
|
||||
use salsa::Cancelled;
|
||||
use salsa::Setter;
|
||||
use salsa::{Cancelled, Setter};
|
||||
|
||||
use crate::setup::Knobs;
|
||||
use crate::setup::KnobsDatabase;
|
||||
use crate::setup::{Knobs, KnobsDatabase};
|
||||
|
||||
#[salsa::input(debug)]
|
||||
struct MyInput {
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
#![cfg(feature = "rayon")]
|
||||
// test for rayon-like join interactions.
|
||||
|
||||
use salsa::Cancelled;
|
||||
use salsa::Setter;
|
||||
use salsa::{Cancelled, Setter};
|
||||
|
||||
use crate::setup::Knobs;
|
||||
use crate::setup::KnobsDatabase;
|
||||
use crate::setup::{Knobs, KnobsDatabase};
|
||||
|
||||
#[salsa::input]
|
||||
struct ParallelInput {
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
#![cfg(feature = "rayon")]
|
||||
// test for rayon-like parallel map interactions.
|
||||
|
||||
use salsa::Cancelled;
|
||||
use salsa::Setter;
|
||||
use salsa::{Cancelled, Setter};
|
||||
|
||||
use crate::setup::Knobs;
|
||||
use crate::setup::KnobsDatabase;
|
||||
use crate::setup::{Knobs, KnobsDatabase};
|
||||
|
||||
#[salsa::input]
|
||||
struct ParallelInput {
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
#![cfg(feature = "rayon")]
|
||||
// test for rayon-like scope interactions.
|
||||
|
||||
use salsa::Cancelled;
|
||||
use salsa::Setter;
|
||||
use salsa::{Cancelled, Setter};
|
||||
|
||||
use crate::setup::Knobs;
|
||||
use crate::setup::KnobsDatabase;
|
||||
use crate::setup::{Knobs, KnobsDatabase};
|
||||
|
||||
#[salsa::input]
|
||||
struct ParallelInput {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
use std::sync::{
|
||||
atomic::{AtomicUsize, Ordering},
|
||||
Arc,
|
||||
};
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::sync::Arc;
|
||||
|
||||
use salsa::Database;
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
//! Singleton structs are created only once. Subsequent `get`s and `new`s after creation return the same `Id`.
|
||||
|
||||
use expect_test::expect;
|
||||
|
||||
use salsa::Database as _;
|
||||
use test_log::test;
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#![allow(warnings)]
|
||||
|
||||
use expect_test::expect;
|
||||
|
||||
use common::{EventLoggerDatabase, HasLogger, LogDatabase, Logger};
|
||||
use expect_test::expect;
|
||||
use salsa::plumbing::HasStorage;
|
||||
use salsa::{Database, Durability, Event, EventKind, Setter};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue