mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
Remove dev-dependency insta
This commit is contained in:
parent
def5a1d0c4
commit
e339c65a1a
24 changed files with 188 additions and 310 deletions
145
Cargo.lock
generated
145
Cargo.lock
generated
|
@ -221,18 +221,6 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "console"
|
||||
version = "0.15.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb"
|
||||
dependencies = [
|
||||
"encode_unicode",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "countme"
|
||||
version = "3.0.1"
|
||||
|
@ -375,12 +363,6 @@ dependencies = [
|
|||
"log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "encode_unicode"
|
||||
version = "0.3.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
|
||||
|
||||
[[package]]
|
||||
name = "env_logger"
|
||||
version = "0.10.2"
|
||||
|
@ -847,19 +829,6 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "insta"
|
||||
version = "1.34.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5d64600be34b2fcfc267740a243fa7744441bb4947a619ac4e5bb6507f35fbfc"
|
||||
dependencies = [
|
||||
"console",
|
||||
"lazy_static",
|
||||
"linked-hash-map",
|
||||
"similar",
|
||||
"yaml-rust",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "intern"
|
||||
version = "0.0.0"
|
||||
|
@ -943,12 +912,6 @@ dependencies = [
|
|||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libm"
|
||||
version = "0.2.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058"
|
||||
|
||||
[[package]]
|
||||
name = "libmimalloc-sys"
|
||||
version = "0.1.33"
|
||||
|
@ -1204,16 +1167,6 @@ dependencies = [
|
|||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"libm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num_cpus"
|
||||
version = "1.15.0"
|
||||
|
@ -1274,7 +1227,7 @@ dependencies = [
|
|||
"libc",
|
||||
"redox_syscall 0.4.1",
|
||||
"smallvec",
|
||||
"windows-targets 0.48.0",
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1619,16 +1572,6 @@ dependencies = [
|
|||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_distr"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
"rand",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rayon"
|
||||
version = "1.8.0"
|
||||
|
@ -1769,14 +1712,13 @@ name = "salsa"
|
|||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"diff",
|
||||
"expect-test",
|
||||
"indexmap",
|
||||
"insta",
|
||||
"linked-hash-map",
|
||||
"lock_api",
|
||||
"oorandom",
|
||||
"parking_lot",
|
||||
"rand",
|
||||
"rand_distr",
|
||||
"rustc-hash",
|
||||
"salsa-macros",
|
||||
"smallvec",
|
||||
|
@ -1886,12 +1828,6 @@ dependencies = [
|
|||
"lazy_static",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "similar"
|
||||
version = "2.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32fea41aca09ee824cc9724996433064c89f7777e60762749a4170a14abbfa21"
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.12.0"
|
||||
|
@ -2426,16 +2362,7 @@ version = "0.48.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
|
||||
dependencies = [
|
||||
"windows-targets 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
||||
dependencies = [
|
||||
"windows-targets 0.52.0",
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2453,21 +2380,6 @@ dependencies = [
|
|||
"windows_x86_64_msvc 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm 0.52.0",
|
||||
"windows_aarch64_msvc 0.52.0",
|
||||
"windows_i686_gnu 0.52.0",
|
||||
"windows_i686_msvc 0.52.0",
|
||||
"windows_x86_64_gnu 0.52.0",
|
||||
"windows_x86_64_gnullvm 0.52.0",
|
||||
"windows_x86_64_msvc 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.42.2"
|
||||
|
@ -2480,12 +2392,6 @@ version = "0.48.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.42.2"
|
||||
|
@ -2498,12 +2404,6 @@ version = "0.48.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.42.2"
|
||||
|
@ -2516,12 +2416,6 @@ version = "0.48.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.42.2"
|
||||
|
@ -2534,12 +2428,6 @@ version = "0.48.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.42.2"
|
||||
|
@ -2552,12 +2440,6 @@ version = "0.48.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.42.2"
|
||||
|
@ -2570,12 +2452,6 @@ version = "0.48.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.42.2"
|
||||
|
@ -2588,12 +2464,6 @@ version = "0.48.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
|
||||
|
||||
[[package]]
|
||||
name = "write-json"
|
||||
version = "0.1.2"
|
||||
|
@ -2643,15 +2513,6 @@ dependencies = [
|
|||
"zip",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "yaml-rust"
|
||||
version = "0.4.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"
|
||||
dependencies = [
|
||||
"linked-hash-map",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zip"
|
||||
version = "0.6.6"
|
||||
|
|
|
@ -28,6 +28,5 @@ salsa-macros = { version = "0.0.0", path = "salsa-macros" }
|
|||
diff = "0.1.13"
|
||||
linked-hash-map = "0.5.6"
|
||||
rand = "0.8.5"
|
||||
rand_distr = "0.4.3"
|
||||
test-log = "0.2.14"
|
||||
insta = "1.18.0"
|
||||
expect-test = "1.4.0"
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
//!
|
||||
use heck::ToSnakeCase;
|
||||
use proc_macro::TokenStream;
|
||||
use syn::parse::{Parse, ParseStream};
|
||||
|
@ -113,10 +114,8 @@ pub(crate) fn database(args: TokenStream, input: TokenStream) -> TokenStream {
|
|||
let mut maybe_changed_ops = proc_macro2::TokenStream::new();
|
||||
let mut cycle_recovery_strategy_ops = proc_macro2::TokenStream::new();
|
||||
let mut for_each_ops = proc_macro2::TokenStream::new();
|
||||
for ((QueryGroup { group_path }, group_storage), group_index) in query_groups
|
||||
.iter()
|
||||
.zip(&query_group_storage_names)
|
||||
.zip(0_u16..)
|
||||
for ((QueryGroup { group_path }, group_storage), group_index) in
|
||||
query_groups.iter().zip(&query_group_storage_names).zip(0_u16..)
|
||||
{
|
||||
fmt_ops.extend(quote! {
|
||||
#group_index => {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
//!
|
||||
pub(crate) struct Parenthesized<T>(pub(crate) T);
|
||||
|
||||
impl<T> syn::parse::Parse for Parenthesized<T>
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
//!
|
||||
use std::{convert::TryFrom, iter::FromIterator};
|
||||
|
||||
use crate::parenthesized::Parenthesized;
|
||||
|
@ -20,12 +21,9 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream
|
|||
let input_span = input.span();
|
||||
let (trait_attrs, salsa_attrs) = filter_attrs(input.attrs);
|
||||
if !salsa_attrs.is_empty() {
|
||||
return Error::new(
|
||||
input_span,
|
||||
format!("unsupported attributes: {:?}", salsa_attrs),
|
||||
)
|
||||
.to_compile_error()
|
||||
.into();
|
||||
return Error::new(input_span, format!("unsupported attributes: {:?}", salsa_attrs))
|
||||
.to_compile_error()
|
||||
.into();
|
||||
}
|
||||
|
||||
let trait_vis = input.vis;
|
||||
|
@ -43,7 +41,8 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream
|
|||
let mut cycle = None;
|
||||
let mut invoke = None;
|
||||
|
||||
let mut query_type = format_ident!("{}Query", query_name.to_string().to_upper_camel_case());
|
||||
let mut query_type =
|
||||
format_ident!("{}Query", query_name.to_string().to_upper_camel_case());
|
||||
let mut num_storages = 0;
|
||||
|
||||
// Extract attributes.
|
||||
|
@ -175,9 +174,7 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream
|
|||
fn_name: lookup_fn_name,
|
||||
receiver: self_receiver.clone(),
|
||||
attrs: vec![], // FIXME -- some automatically generated docs on this method?
|
||||
storage: QueryStorage::InternedLookup {
|
||||
intern_query_type: query_type.clone(),
|
||||
},
|
||||
storage: QueryStorage::InternedLookup { intern_query_type: query_type.clone() },
|
||||
keys: lookup_keys,
|
||||
value: lookup_value,
|
||||
invoke: None,
|
||||
|
@ -211,9 +208,9 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream
|
|||
let mut storage_fields = proc_macro2::TokenStream::new();
|
||||
let mut queries_with_storage = vec![];
|
||||
for query in &queries {
|
||||
#[allow(clippy::map_identity)] // clippy is incorrect here, this is not the identity function due to match ergonomics
|
||||
let (key_names, keys): (Vec<_>, Vec<_>) =
|
||||
query.keys.iter().map(|(a, b)| (a, b)).unzip();
|
||||
#[allow(clippy::map_identity)]
|
||||
// clippy is incorrect here, this is not the identity function due to match ergonomics
|
||||
let (key_names, keys): (Vec<_>, Vec<_>) = query.keys.iter().map(|(a, b)| (a, b)).unzip();
|
||||
let value = &query.value;
|
||||
let fn_name = &query.fn_name;
|
||||
let qt = &query.query_type;
|
||||
|
@ -361,11 +358,8 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream
|
|||
}
|
||||
});
|
||||
|
||||
let non_transparent_queries = || {
|
||||
queries
|
||||
.iter()
|
||||
.filter(|q| !matches!(q.storage, QueryStorage::Transparent))
|
||||
};
|
||||
let non_transparent_queries =
|
||||
|| queries.iter().filter(|q| !matches!(q.storage, QueryStorage::Transparent));
|
||||
|
||||
// Emit the query types.
|
||||
for (query, query_index) in non_transparent_queries().zip(0_u16..) {
|
||||
|
@ -681,11 +675,7 @@ impl TryFrom<syn::Attribute> for SalsaAttr {
|
|||
}
|
||||
|
||||
fn is_not_salsa_attr_path(path: &syn::Path) -> bool {
|
||||
path.segments
|
||||
.first()
|
||||
.map(|s| s.ident != "salsa")
|
||||
.unwrap_or(true)
|
||||
|| path.segments.len() != 2
|
||||
path.segments.first().map(|s| s.ident != "salsa").unwrap_or(true) || path.segments.len() != 2
|
||||
}
|
||||
|
||||
fn filter_attrs(attrs: Vec<Attribute>) -> (Vec<Attribute>, Vec<SalsaAttr>) {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
//!
|
||||
use crate::debug::TableEntry;
|
||||
use crate::durability::Durability;
|
||||
use crate::hash::FxIndexMap;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
//!
|
||||
use crate::debug::TableEntry;
|
||||
use crate::derived::MemoizationPolicy;
|
||||
use crate::durability::Durability;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
//!
|
||||
#![allow(dead_code)]
|
||||
|
||||
/// Test that a database with a key/value that is not `Send` will,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
//!
|
||||
/// Describes how likely a value is to change -- how "durable" it is.
|
||||
/// By default, inputs have `Durability::LOW` and interned values have
|
||||
/// `Durability::HIGH`. But inputs can be explicitly set with other
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
//!
|
||||
pub(crate) type FxHasher = std::hash::BuildHasherDefault<rustc_hash::FxHasher>;
|
||||
pub(crate) type FxIndexSet<K> = indexmap::IndexSet<K, FxHasher>;
|
||||
pub(crate) type FxIndexMap<K, V> = indexmap::IndexMap<K, V, FxHasher>;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
//!
|
||||
use crate::debug::TableEntry;
|
||||
use crate::durability::Durability;
|
||||
use crate::hash::FxIndexMap;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
//!
|
||||
use std::fmt;
|
||||
use std::num::NonZeroU32;
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
//!
|
||||
use crate::debug::TableEntry;
|
||||
use crate::durability::Durability;
|
||||
use crate::intern_id::InternId;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
//!
|
||||
#![allow(clippy::type_complexity)]
|
||||
#![allow(clippy::question_mark)]
|
||||
#![warn(rust_2018_idioms)]
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
//!
|
||||
use oorandom::Rand64;
|
||||
use parking_lot::Mutex;
|
||||
use std::fmt::Debug;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
//!
|
||||
#![allow(missing_docs)]
|
||||
|
||||
use crate::debug::TableEntry;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
//!
|
||||
use std::num::NonZeroU32;
|
||||
use std::sync::atomic::{AtomicU32, Ordering};
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
//!
|
||||
use crate::durability::Durability;
|
||||
use crate::hash::FxIndexSet;
|
||||
use crate::plumbing::CycleRecoveryStrategy;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
//!
|
||||
use triomphe::Arc;
|
||||
|
||||
use crate::{DatabaseKeyIndex, RuntimeId};
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
//!
|
||||
use tracing::debug;
|
||||
|
||||
use crate::durability::Durability;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
//!
|
||||
use crate::{plumbing::DatabaseStorageTypes, Runtime};
|
||||
use triomphe::Arc;
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use std::panic::UnwindSafe;
|
||||
|
||||
use expect_test::expect;
|
||||
use salsa::{Durability, ParallelDatabase, Snapshot};
|
||||
use test_log::test;
|
||||
|
||||
|
@ -179,24 +180,26 @@ fn extract_cycle(f: impl FnOnce() + UnwindSafe) -> salsa::Cycle {
|
|||
fn cycle_memoized() {
|
||||
let db = DatabaseImpl::default();
|
||||
let cycle = extract_cycle(|| db.memoized_a());
|
||||
insta::assert_debug_snapshot!(cycle.unexpected_participants(&db), @r###"
|
||||
[
|
||||
"memoized_a(())",
|
||||
"memoized_b(())",
|
||||
]
|
||||
"###);
|
||||
expect![[r#"
|
||||
[
|
||||
"memoized_a(())",
|
||||
"memoized_b(())",
|
||||
]
|
||||
"#]]
|
||||
.assert_debug_eq(&cycle.unexpected_participants(&db));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cycle_volatile() {
|
||||
let db = DatabaseImpl::default();
|
||||
let cycle = extract_cycle(|| db.volatile_a());
|
||||
insta::assert_debug_snapshot!(cycle.unexpected_participants(&db), @r###"
|
||||
[
|
||||
"volatile_a(())",
|
||||
"volatile_b(())",
|
||||
]
|
||||
"###);
|
||||
expect![[r#"
|
||||
[
|
||||
"volatile_a(())",
|
||||
"volatile_b(())",
|
||||
]
|
||||
"#]]
|
||||
.assert_debug_eq(&cycle.unexpected_participants(&db));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -228,12 +231,13 @@ fn inner_cycle() {
|
|||
let err = query.cycle_c();
|
||||
assert!(err.is_err());
|
||||
let cycle = err.unwrap_err().cycle;
|
||||
insta::assert_debug_snapshot!(cycle, @r###"
|
||||
[
|
||||
"cycle_a(())",
|
||||
"cycle_b(())",
|
||||
]
|
||||
"###);
|
||||
expect![[r#"
|
||||
[
|
||||
"cycle_a(())",
|
||||
"cycle_b(())",
|
||||
]
|
||||
"#]]
|
||||
.assert_debug_eq(&cycle);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -265,16 +269,17 @@ fn cycle_revalidate_unchanged_twice() {
|
|||
db.set_c_invokes(CycleQuery::A); // force new revisi5on
|
||||
|
||||
// on this run
|
||||
insta::assert_debug_snapshot!(db.cycle_a(), @r###"
|
||||
Err(
|
||||
Error {
|
||||
cycle: [
|
||||
"cycle_a(())",
|
||||
"cycle_b(())",
|
||||
],
|
||||
},
|
||||
)
|
||||
"###);
|
||||
expect![[r#"
|
||||
Err(
|
||||
Error {
|
||||
cycle: [
|
||||
"cycle_a(())",
|
||||
"cycle_b(())",
|
||||
],
|
||||
},
|
||||
)
|
||||
"#]]
|
||||
.assert_debug_eq(&db.cycle_a());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -346,16 +351,17 @@ fn cycle_mixed_1() {
|
|||
db.set_c_invokes(CycleQuery::B);
|
||||
|
||||
let u = db.cycle_c();
|
||||
insta::assert_debug_snapshot!(u, @r###"
|
||||
Err(
|
||||
Error {
|
||||
cycle: [
|
||||
"cycle_b(())",
|
||||
"cycle_c(())",
|
||||
],
|
||||
},
|
||||
)
|
||||
"###);
|
||||
expect![[r#"
|
||||
Err(
|
||||
Error {
|
||||
cycle: [
|
||||
"cycle_b(())",
|
||||
"cycle_c(())",
|
||||
],
|
||||
},
|
||||
)
|
||||
"#]]
|
||||
.assert_debug_eq(&u);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -372,17 +378,18 @@ fn cycle_mixed_2() {
|
|||
db.set_c_invokes(CycleQuery::A);
|
||||
|
||||
let u = db.cycle_a();
|
||||
insta::assert_debug_snapshot!(u, @r###"
|
||||
Err(
|
||||
Error {
|
||||
cycle: [
|
||||
"cycle_a(())",
|
||||
"cycle_b(())",
|
||||
"cycle_c(())",
|
||||
],
|
||||
},
|
||||
)
|
||||
"###);
|
||||
expect![[r#"
|
||||
Err(
|
||||
Error {
|
||||
cycle: [
|
||||
"cycle_a(())",
|
||||
"cycle_b(())",
|
||||
"cycle_c(())",
|
||||
],
|
||||
},
|
||||
)
|
||||
"#]]
|
||||
.assert_debug_eq(&u);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -399,26 +406,27 @@ fn cycle_deterministic_order() {
|
|||
};
|
||||
let a = db().cycle_a();
|
||||
let b = db().cycle_b();
|
||||
insta::assert_debug_snapshot!((a, b), @r###"
|
||||
(
|
||||
Err(
|
||||
Error {
|
||||
cycle: [
|
||||
"cycle_a(())",
|
||||
"cycle_b(())",
|
||||
],
|
||||
},
|
||||
),
|
||||
Err(
|
||||
Error {
|
||||
cycle: [
|
||||
"cycle_a(())",
|
||||
"cycle_b(())",
|
||||
],
|
||||
},
|
||||
),
|
||||
)
|
||||
"###);
|
||||
expect![[r#"
|
||||
(
|
||||
Err(
|
||||
Error {
|
||||
cycle: [
|
||||
"cycle_a(())",
|
||||
"cycle_b(())",
|
||||
],
|
||||
},
|
||||
),
|
||||
Err(
|
||||
Error {
|
||||
cycle: [
|
||||
"cycle_a(())",
|
||||
"cycle_b(())",
|
||||
],
|
||||
},
|
||||
),
|
||||
)
|
||||
"#]]
|
||||
.assert_debug_eq(&(a, b));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -443,34 +451,35 @@ fn cycle_multiple() {
|
|||
let c = db.cycle_c();
|
||||
let b = db.cycle_b();
|
||||
let a = db.cycle_a();
|
||||
insta::assert_debug_snapshot!((a, b, c), @r###"
|
||||
(
|
||||
Err(
|
||||
Error {
|
||||
cycle: [
|
||||
"cycle_a(())",
|
||||
"cycle_b(())",
|
||||
],
|
||||
},
|
||||
),
|
||||
Err(
|
||||
Error {
|
||||
cycle: [
|
||||
"cycle_a(())",
|
||||
"cycle_b(())",
|
||||
],
|
||||
},
|
||||
),
|
||||
Err(
|
||||
Error {
|
||||
cycle: [
|
||||
"cycle_a(())",
|
||||
"cycle_b(())",
|
||||
],
|
||||
},
|
||||
),
|
||||
)
|
||||
"###);
|
||||
expect![[r#"
|
||||
(
|
||||
Err(
|
||||
Error {
|
||||
cycle: [
|
||||
"cycle_a(())",
|
||||
"cycle_b(())",
|
||||
],
|
||||
},
|
||||
),
|
||||
Err(
|
||||
Error {
|
||||
cycle: [
|
||||
"cycle_a(())",
|
||||
"cycle_b(())",
|
||||
],
|
||||
},
|
||||
),
|
||||
Err(
|
||||
Error {
|
||||
cycle: [
|
||||
"cycle_a(())",
|
||||
"cycle_b(())",
|
||||
],
|
||||
},
|
||||
),
|
||||
)
|
||||
"#]]
|
||||
.assert_debug_eq(&(a, b, c));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -485,9 +494,10 @@ fn cycle_recovery_set_but_not_participating() {
|
|||
|
||||
// Here we expect C to panic and A not to recover:
|
||||
let r = extract_cycle(|| drop(db.cycle_a()));
|
||||
insta::assert_debug_snapshot!(r.all_participants(&db), @r###"
|
||||
[
|
||||
"cycle_c(())",
|
||||
]
|
||||
"###);
|
||||
expect![[r#"
|
||||
[
|
||||
"cycle_c(())",
|
||||
]
|
||||
"#]]
|
||||
.assert_debug_eq(&r.all_participants(&db));
|
||||
}
|
||||
|
|
|
@ -100,16 +100,16 @@ fn on_demand_input_durability() {
|
|||
db.external_state.insert(2, 20);
|
||||
assert_eq!(db.b(1), 10);
|
||||
assert_eq!(db.b(2), 20);
|
||||
insta::assert_debug_snapshot!(events, @r###"
|
||||
RefCell {
|
||||
value: [
|
||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: b(1) } }",
|
||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: a(1) } }",
|
||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: b(2) } }",
|
||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: a(2) } }",
|
||||
],
|
||||
}
|
||||
"###);
|
||||
expect_test::expect![[r#"
|
||||
RefCell {
|
||||
value: [
|
||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: b(1) } }",
|
||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: a(1) } }",
|
||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: b(2) } }",
|
||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: a(2) } }",
|
||||
],
|
||||
}
|
||||
"#]].assert_debug_eq(&events);
|
||||
|
||||
eprintln!("------------------");
|
||||
db.salsa_runtime_mut().synthetic_write(Durability::LOW);
|
||||
|
@ -117,17 +117,17 @@ fn on_demand_input_durability() {
|
|||
assert_eq!(db.c(1), 10);
|
||||
assert_eq!(db.c(2), 20);
|
||||
// Re-execute `a(2)` because that has low durability, but not `a(1)`
|
||||
insta::assert_debug_snapshot!(events, @r###"
|
||||
RefCell {
|
||||
value: [
|
||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: c(1) } }",
|
||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: DidValidateMemoizedValue { database_key: b(1) } }",
|
||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: c(2) } }",
|
||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: a(2) } }",
|
||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: DidValidateMemoizedValue { database_key: b(2) } }",
|
||||
],
|
||||
}
|
||||
"###);
|
||||
expect_test::expect![[r#"
|
||||
RefCell {
|
||||
value: [
|
||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: c(1) } }",
|
||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: DidValidateMemoizedValue { database_key: b(1) } }",
|
||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: c(2) } }",
|
||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: a(2) } }",
|
||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: DidValidateMemoizedValue { database_key: b(2) } }",
|
||||
],
|
||||
}
|
||||
"#]].assert_debug_eq(&events);
|
||||
|
||||
eprintln!("------------------");
|
||||
db.salsa_runtime_mut().synthetic_write(Durability::HIGH);
|
||||
|
@ -136,14 +136,14 @@ fn on_demand_input_durability() {
|
|||
assert_eq!(db.c(2), 20);
|
||||
// Re-execute both `a(1)` and `a(2)`, but we don't re-execute any `b` queries as the
|
||||
// result didn't actually change.
|
||||
insta::assert_debug_snapshot!(events, @r###"
|
||||
RefCell {
|
||||
value: [
|
||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: a(1) } }",
|
||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: DidValidateMemoizedValue { database_key: c(1) } }",
|
||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: a(2) } }",
|
||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: DidValidateMemoizedValue { database_key: c(2) } }",
|
||||
],
|
||||
}
|
||||
"###);
|
||||
expect_test::expect![[r#"
|
||||
RefCell {
|
||||
value: [
|
||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: a(1) } }",
|
||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: DidValidateMemoizedValue { database_key: c(1) } }",
|
||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: a(2) } }",
|
||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: DidValidateMemoizedValue { database_key: c(2) } }",
|
||||
],
|
||||
}
|
||||
"#]].assert_debug_eq(&events);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
//! both intra and cross thread.
|
||||
|
||||
use crate::setup::{Knobs, ParDatabaseImpl};
|
||||
use expect_test::expect;
|
||||
use salsa::ParallelDatabase;
|
||||
use test_log::test;
|
||||
|
||||
|
@ -25,12 +26,13 @@ fn parallel_cycle_none_recover() {
|
|||
// Right now, it panics with a string.
|
||||
let err_b = thread_b.join().unwrap_err();
|
||||
if let Some(c) = err_b.downcast_ref::<salsa::Cycle>() {
|
||||
insta::assert_debug_snapshot!(c.unexpected_participants(&db), @r###"
|
||||
[
|
||||
"a(-1)",
|
||||
"b(-1)",
|
||||
]
|
||||
"###);
|
||||
expect![[r#"
|
||||
[
|
||||
"a(-1)",
|
||||
"b(-1)",
|
||||
]
|
||||
"#]]
|
||||
.assert_debug_eq(&c.unexpected_participants(&db));
|
||||
} else {
|
||||
panic!("b failed in an unexpected way: {:?}", err_b);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue