Auto merge of #16772 - Veykril:salsa-tracing, r=Veykril

internal: Add tracing spans to macro generated database
This commit is contained in:
bors 2024-03-07 10:16:53 +00:00
commit 00f6a7aced
16 changed files with 174 additions and 176 deletions

View File

@ -43,7 +43,7 @@ pub trait Upcast<T: ?Sized> {
} }
pub const DEFAULT_PARSE_LRU_CAP: usize = 128; pub const DEFAULT_PARSE_LRU_CAP: usize = 128;
pub const DEFAULT_BORROWCK_LRU_CAP: usize = 256; pub const DEFAULT_BORROWCK_LRU_CAP: usize = 1024;
pub trait FileLoader { pub trait FileLoader {
/// Text of the file. /// Text of the file.

View File

@ -348,7 +348,7 @@ impl AttrsWithOwner {
.raw_attrs(AttrOwner::ModItem(definition_tree_id.value.into())) .raw_attrs(AttrOwner::ModItem(definition_tree_id.value.into()))
.clone(), .clone(),
ModuleOrigin::BlockExpr { id, .. } => { ModuleOrigin::BlockExpr { id, .. } => {
let tree = db.block_item_tree_query(id); let tree = db.block_item_tree(id);
tree.raw_attrs(AttrOwner::TopLevel).clone() tree.raw_attrs(AttrOwner::TopLevel).clone()
} }
} }

View File

@ -87,14 +87,10 @@ pub trait DefDatabase: InternDatabase + ExpandDatabase + Upcast<dyn ExpandDataba
fn file_item_tree(&self, file_id: HirFileId) -> Arc<ItemTree>; fn file_item_tree(&self, file_id: HirFileId) -> Arc<ItemTree>;
#[salsa::invoke(ItemTree::block_item_tree_query)] #[salsa::invoke(ItemTree::block_item_tree_query)]
fn block_item_tree_query(&self, block_id: BlockId) -> Arc<ItemTree>; fn block_item_tree(&self, block_id: BlockId) -> Arc<ItemTree>;
#[salsa::invoke(crate_def_map_wait)]
#[salsa::transparent]
fn crate_def_map(&self, krate: CrateId) -> Arc<DefMap>;
#[salsa::invoke(DefMap::crate_def_map_query)] #[salsa::invoke(DefMap::crate_def_map_query)]
fn crate_def_map_query(&self, krate: CrateId) -> Arc<DefMap>; fn crate_def_map(&self, krate: CrateId) -> Arc<DefMap>;
/// Computes the block-level `DefMap`. /// Computes the block-level `DefMap`.
#[salsa::invoke(DefMap::block_def_map_query)] #[salsa::invoke(DefMap::block_def_map_query)]
@ -253,11 +249,6 @@ fn include_macro_invoc(db: &dyn DefDatabase, krate: CrateId) -> Vec<(MacroCallId
.collect() .collect()
} }
fn crate_def_map_wait(db: &dyn DefDatabase, krate: CrateId) -> Arc<DefMap> {
let _p = tracing::span!(tracing::Level::INFO, "crate_def_map:wait").entered();
db.crate_def_map_query(krate)
}
fn crate_supports_no_std(db: &dyn DefDatabase, crate_id: CrateId) -> bool { fn crate_supports_no_std(db: &dyn DefDatabase, crate_id: CrateId) -> bool {
let file = db.crate_graph()[crate_id].root_file_id; let file = db.crate_graph()[crate_id].root_file_id;
let item_tree = db.file_item_tree(file.into()); let item_tree = db.file_item_tree(file.into());

View File

@ -392,7 +392,7 @@ impl TreeId {
pub(crate) fn item_tree(&self, db: &dyn DefDatabase) -> Arc<ItemTree> { pub(crate) fn item_tree(&self, db: &dyn DefDatabase) -> Arc<ItemTree> {
match self.block { match self.block {
Some(block) => db.block_item_tree_query(block), Some(block) => db.block_item_tree(block),
None => db.file_item_tree(self.file), None => db.file_item_tree(self.file),
} }
} }

View File

@ -31,12 +31,8 @@ use hir_expand::name::Name;
#[salsa::query_group(HirDatabaseStorage)] #[salsa::query_group(HirDatabaseStorage)]
pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> { pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> {
#[salsa::invoke(infer_wait)]
#[salsa::transparent]
fn infer(&self, def: DefWithBodyId) -> Arc<InferenceResult>;
#[salsa::invoke(crate::infer::infer_query)] #[salsa::invoke(crate::infer::infer_query)]
fn infer_query(&self, def: DefWithBodyId) -> Arc<InferenceResult>; fn infer(&self, def: DefWithBodyId) -> Arc<InferenceResult>;
// region:mir // region:mir
@ -258,17 +254,8 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> {
env: Arc<TraitEnvironment>, env: Arc<TraitEnvironment>,
) -> Ty; ) -> Ty;
#[salsa::invoke(trait_solve_wait)]
#[salsa::transparent]
fn trait_solve(
&self,
krate: CrateId,
block: Option<BlockId>,
goal: crate::Canonical<crate::InEnvironment<crate::Goal>>,
) -> Option<crate::Solution>;
#[salsa::invoke(crate::traits::trait_solve_query)] #[salsa::invoke(crate::traits::trait_solve_query)]
fn trait_solve_query( fn trait_solve(
&self, &self,
krate: CrateId, krate: CrateId,
block: Option<BlockId>, block: Option<BlockId>,
@ -284,38 +271,6 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> {
) -> chalk_ir::ProgramClauses<Interner>; ) -> chalk_ir::ProgramClauses<Interner>;
} }
fn infer_wait(db: &dyn HirDatabase, def: DefWithBodyId) -> Arc<InferenceResult> {
let detail = match def {
DefWithBodyId::FunctionId(it) => db.function_data(it).name.display(db.upcast()).to_string(),
DefWithBodyId::StaticId(it) => {
db.static_data(it).name.clone().display(db.upcast()).to_string()
}
DefWithBodyId::ConstId(it) => db
.const_data(it)
.name
.clone()
.unwrap_or_else(Name::missing)
.display(db.upcast())
.to_string(),
DefWithBodyId::VariantId(it) => {
db.enum_variant_data(it).name.display(db.upcast()).to_string()
}
DefWithBodyId::InTypeConstId(it) => format!("in type const {it:?}"),
};
let _p = tracing::span!(tracing::Level::INFO, "infer:wait", ?detail).entered();
db.infer_query(def)
}
fn trait_solve_wait(
db: &dyn HirDatabase,
krate: CrateId,
block: Option<BlockId>,
goal: crate::Canonical<crate::InEnvironment<crate::Goal>>,
) -> Option<crate::Solution> {
let _p = tracing::span!(tracing::Level::INFO, "trait_solve::wait").entered();
db.trait_solve_query(krate, block, goal)
}
#[test] #[test]
fn hir_database_is_object_safe() { fn hir_database_is_object_safe() {
fn _assert_object_safe(_: &dyn HirDatabase) {} fn _assert_object_safe(_: &dyn HirDatabase) {}

View File

@ -4,20 +4,20 @@
//! //!
//! But we need this for at least LRU caching at the query level. //! But we need this for at least LRU caching at the query level.
pub use hir_def::db::{ pub use hir_def::db::{
AttrsQuery, BlockDefMapQuery, BlockItemTreeQueryQuery, BodyQuery, BodyWithSourceMapQuery, AttrsQuery, BlockDefMapQuery, BodyQuery, BodyWithSourceMapQuery, ConstDataQuery,
ConstDataQuery, ConstVisibilityQuery, CrateDefMapQueryQuery, CrateLangItemsQuery, ConstVisibilityQuery, CrateLangItemsQuery, CrateSupportsNoStdQuery, DefDatabase,
CrateSupportsNoStdQuery, DefDatabase, DefDatabaseStorage, EnumDataQuery, DefDatabaseStorage, EnumDataQuery, EnumVariantDataWithDiagnosticsQuery, ExprScopesQuery,
EnumVariantDataWithDiagnosticsQuery, ExprScopesQuery, ExternCrateDeclDataQuery, ExternCrateDeclDataQuery, FieldVisibilitiesQuery, FieldsAttrsQuery, FieldsAttrsSourceMapQuery,
FieldVisibilitiesQuery, FieldsAttrsQuery, FieldsAttrsSourceMapQuery, FileItemTreeQuery, FileItemTreeQuery, FunctionDataQuery, FunctionVisibilityQuery, GenericParamsQuery,
FunctionDataQuery, FunctionVisibilityQuery, GenericParamsQuery, ImplDataWithDiagnosticsQuery, ImplDataWithDiagnosticsQuery, ImportMapQuery, InternAnonymousConstQuery, InternBlockQuery,
ImportMapQuery, InternAnonymousConstQuery, InternBlockQuery, InternConstQuery, InternDatabase, InternConstQuery, InternDatabase, InternDatabaseStorage, InternEnumQuery,
InternDatabaseStorage, InternEnumQuery, InternExternBlockQuery, InternExternCrateQuery, InternExternBlockQuery, InternExternCrateQuery, InternFunctionQuery, InternImplQuery,
InternFunctionQuery, InternImplQuery, InternInTypeConstQuery, InternMacro2Query, InternInTypeConstQuery, InternMacro2Query, InternMacroRulesQuery, InternProcMacroQuery,
InternMacroRulesQuery, InternProcMacroQuery, InternStaticQuery, InternStructQuery, InternStaticQuery, InternStructQuery, InternTraitAliasQuery, InternTraitQuery,
InternTraitAliasQuery, InternTraitQuery, InternTypeAliasQuery, InternUnionQuery, InternTypeAliasQuery, InternUnionQuery, InternUseQuery, LangItemQuery, Macro2DataQuery,
InternUseQuery, LangItemQuery, Macro2DataQuery, MacroRulesDataQuery, ProcMacroDataQuery, MacroRulesDataQuery, ProcMacroDataQuery, StaticDataQuery, StructDataWithDiagnosticsQuery,
StaticDataQuery, StructDataWithDiagnosticsQuery, TraitAliasDataQuery, TraitAliasDataQuery, TraitDataWithDiagnosticsQuery, TypeAliasDataQuery,
TraitDataWithDiagnosticsQuery, TypeAliasDataQuery, UnionDataWithDiagnosticsQuery, UnionDataWithDiagnosticsQuery,
}; };
pub use hir_expand::db::{ pub use hir_expand::db::{
AstIdMapQuery, DeclMacroExpanderQuery, ExpandDatabase, ExpandDatabaseStorage, AstIdMapQuery, DeclMacroExpanderQuery, ExpandDatabase, ExpandDatabaseStorage,

View File

@ -91,7 +91,6 @@ impl RootDatabase {
crate::symbol_index::LocalRootsQuery crate::symbol_index::LocalRootsQuery
crate::symbol_index::LibraryRootsQuery crate::symbol_index::LibraryRootsQuery
// HirDatabase // HirDatabase
hir::db::InferQueryQuery
hir::db::MirBodyQuery hir::db::MirBodyQuery
hir::db::BorrowckQuery hir::db::BorrowckQuery
hir::db::TyQuery hir::db::TyQuery
@ -130,12 +129,10 @@ impl RootDatabase {
hir::db::FnDefVarianceQuery hir::db::FnDefVarianceQuery
hir::db::AdtVarianceQuery hir::db::AdtVarianceQuery
hir::db::AssociatedTyValueQuery hir::db::AssociatedTyValueQuery
hir::db::TraitSolveQueryQuery
hir::db::ProgramClausesForChalkEnvQuery hir::db::ProgramClausesForChalkEnvQuery
// DefDatabase // DefDatabase
hir::db::FileItemTreeQuery hir::db::FileItemTreeQuery
hir::db::CrateDefMapQueryQuery
hir::db::BlockDefMapQuery hir::db::BlockDefMapQuery
hir::db::StructDataWithDiagnosticsQuery hir::db::StructDataWithDiagnosticsQuery
hir::db::UnionDataWithDiagnosticsQuery hir::db::UnionDataWithDiagnosticsQuery
@ -165,7 +162,6 @@ impl RootDatabase {
hir::db::FunctionVisibilityQuery hir::db::FunctionVisibilityQuery
hir::db::ConstVisibilityQuery hir::db::ConstVisibilityQuery
hir::db::CrateSupportsNoStdQuery hir::db::CrateSupportsNoStdQuery
hir::db::BlockItemTreeQueryQuery
hir::db::ExternCrateDeclDataQuery hir::db::ExternCrateDeclDataQuery
hir::db::InternAnonymousConstQuery hir::db::InternAnonymousConstQuery
hir::db::InternExternCrateQuery hir::db::InternExternCrateQuery

View File

@ -216,7 +216,6 @@ impl RootDatabase {
// DefDatabase // DefDatabase
hir_db::FileItemTreeQuery hir_db::FileItemTreeQuery
hir_db::CrateDefMapQueryQuery
hir_db::BlockDefMapQuery hir_db::BlockDefMapQuery
hir_db::StructDataWithDiagnosticsQuery hir_db::StructDataWithDiagnosticsQuery
hir_db::UnionDataWithDiagnosticsQuery hir_db::UnionDataWithDiagnosticsQuery
@ -248,7 +247,6 @@ impl RootDatabase {
hir_db::CrateSupportsNoStdQuery hir_db::CrateSupportsNoStdQuery
// HirDatabase // HirDatabase
hir_db::InferQueryQuery
hir_db::MirBodyQuery hir_db::MirBodyQuery
hir_db::BorrowckQuery hir_db::BorrowckQuery
hir_db::TyQuery hir_db::TyQuery
@ -287,7 +285,6 @@ impl RootDatabase {
hir_db::FnDefVarianceQuery hir_db::FnDefVarianceQuery
hir_db::AdtVarianceQuery hir_db::AdtVarianceQuery
hir_db::AssociatedTyValueQuery hir_db::AssociatedTyValueQuery
hir_db::TraitSolveQueryQuery
hir_db::ProgramClausesForChalkEnvQuery hir_db::ProgramClausesForChalkEnvQuery
// SymbolsDatabase // SymbolsDatabase

View File

@ -11,7 +11,9 @@
//! which you can use to paste the command in terminal and add `--release` manually. //! which you can use to paste the command in terminal and add `--release` manually.
use hir::ChangeWithProcMacros; use hir::ChangeWithProcMacros;
use ide::{AnalysisHost, CallableSnippets, CompletionConfig, FilePosition, TextSize}; use ide::{
AnalysisHost, CallableSnippets, CompletionConfig, DiagnosticsConfig, FilePosition, TextSize,
};
use ide_db::{ use ide_db::{
imports::insert_use::{ImportGranularity, InsertUseConfig}, imports::insert_use::{ImportGranularity, InsertUseConfig},
SnippetCap, SnippetCap,
@ -157,7 +159,7 @@ fn integrated_completion_benchmark() {
analysis.completions(&config, position, None).unwrap(); analysis.completions(&config, position, None).unwrap();
} }
crate::tracing::hprof::init("*>5"); let _g = crate::tracing::hprof::init("*");
let completion_offset = { let completion_offset = {
let _it = stdx::timeit("change"); let _it = stdx::timeit("change");
@ -244,6 +246,80 @@ fn integrated_completion_benchmark() {
} }
} }
#[test]
fn integrated_diagnostics_benchmark() {
if std::env::var("RUN_SLOW_BENCHES").is_err() {
return;
}
// Load rust-analyzer itself.
let workspace_to_load = project_root();
let file = "./crates/hir/src/lib.rs";
let cargo_config = CargoConfig {
sysroot: Some(project_model::RustLibSource::Discover),
..CargoConfig::default()
};
let load_cargo_config = LoadCargoConfig {
load_out_dirs_from_check: true,
with_proc_macro_server: ProcMacroServerChoice::None,
prefill_caches: true,
};
let (db, vfs, _proc_macro) = {
let _it = stdx::timeit("workspace loading");
load_workspace_at(&workspace_to_load, &cargo_config, &load_cargo_config, &|_| {}).unwrap()
};
let mut host = AnalysisHost::with_database(db);
let file_id = {
let file = workspace_to_load.join(file);
let path = VfsPath::from(AbsPathBuf::assert(file));
vfs.file_id(&path).unwrap_or_else(|| panic!("can't find virtual file for {path}"))
};
let diagnostics_config = DiagnosticsConfig {
enabled: false,
proc_macros_enabled: true,
proc_attr_macros_enabled: true,
disable_experimental: true,
disabled: Default::default(),
expr_fill_default: Default::default(),
style_lints: false,
insert_use: InsertUseConfig {
granularity: ImportGranularity::Crate,
enforce_granularity: false,
prefix_kind: hir::PrefixKind::ByCrate,
group: true,
skip_glob_imports: true,
},
prefer_no_std: false,
prefer_prelude: false,
};
host.analysis()
.diagnostics(&diagnostics_config, ide::AssistResolveStrategy::None, file_id)
.unwrap();
let _g = crate::tracing::hprof::init("*>1");
{
let _it = stdx::timeit("change");
let mut text = host.analysis().file_text(file_id).unwrap().to_string();
patch(&mut text, "db.struct_data(self.id)", "();\ndb.struct_data(self.id)");
let mut change = ChangeWithProcMacros::new();
change.change_file(file_id, Some(Arc::from(text)));
host.apply_change(change);
};
{
let _p = tracing::span!(tracing::Level::INFO, "diagnostics").entered();
let _span = profile::cpu_span();
host.analysis()
.diagnostics(&diagnostics_config, ide::AssistResolveStrategy::None, file_id)
.unwrap();
}
}
fn patch(what: &mut String, from: &str, to: &str) -> usize { fn patch(what: &mut String, from: &str, to: &str) -> usize {
let idx = what.find(from).unwrap(); let idx = what.find(from).unwrap();
*what = what.replacen(from, to, 1); *what = what.replacen(from, to, 1);

View File

@ -4,13 +4,10 @@
use std::io; use std::io;
use anyhow::Context; use anyhow::Context;
use tracing::{level_filters::LevelFilter, Level}; use tracing::level_filters::LevelFilter;
use tracing_subscriber::{ use tracing_subscriber::{
filter::{self, Targets}, filter::Targets, fmt::MakeWriter, layer::SubscriberExt, util::SubscriberInitExt, Layer,
fmt::{format::FmtSpan, MakeWriter}, Registry,
layer::SubscriberExt,
util::SubscriberInitExt,
Layer, Registry,
}; };
use tracing_tree::HierarchicalLayer; use tracing_tree::HierarchicalLayer;
@ -50,10 +47,7 @@ where
let writer = self.writer; let writer = self.writer;
let ra_fmt_layer = tracing_subscriber::fmt::layer() let ra_fmt_layer = tracing_subscriber::fmt::layer().with_writer(writer).with_filter(filter);
.with_span_events(FmtSpan::CLOSE)
.with_writer(writer)
.with_filter(filter);
let mut chalk_layer = None; let mut chalk_layer = None;
if let Some(chalk_filter) = self.chalk_filter { if let Some(chalk_filter) = self.chalk_filter {
@ -74,32 +68,7 @@ where
); );
}; };
let mut profiler_layer = None; let profiler_layer = self.profile_filter.map(|spec| hprof::layer(&spec));
if let Some(spec) = self.profile_filter {
let (write_filter, allowed_names) = hprof::WriteFilter::from_spec(&spec);
// this filter the first pass for `tracing`: these are all the "profiling" spans, but things like
// span depth or duration are not filtered here: that only occurs at write time.
let profile_filter = filter::filter_fn(move |metadata| {
let allowed = match &allowed_names {
Some(names) => names.contains(metadata.name()),
None => true,
};
metadata.is_span()
&& allowed
&& metadata.level() >= &Level::INFO
&& !metadata.target().starts_with("salsa")
&& !metadata.target().starts_with("chalk")
});
let layer = hprof::SpanTree::default()
.aggregate(true)
.spec_filter(write_filter)
.with_filter(profile_filter);
profiler_layer = Some(layer);
}
Registry::default().with(ra_fmt_layer).with(chalk_layer).with(profiler_layer).try_init()?; Registry::default().with(ra_fmt_layer).with(chalk_layer).with(profiler_layer).try_init()?;

View File

@ -53,6 +53,14 @@ use tracing_subscriber::{
use crate::tracing::hprof; use crate::tracing::hprof;
pub fn init(spec: &str) -> tracing::subscriber::DefaultGuard { pub fn init(spec: &str) -> tracing::subscriber::DefaultGuard {
let subscriber = Registry::default().with(layer(spec));
tracing::subscriber::set_default(subscriber)
}
pub fn layer<S>(spec: &str) -> impl Layer<S>
where
S: Subscriber + for<'span> tracing_subscriber::registry::LookupSpan<'span>,
{
let (write_filter, allowed_names) = WriteFilter::from_spec(spec); let (write_filter, allowed_names) = WriteFilter::from_spec(spec);
// this filter the first pass for `tracing`: these are all the "profiling" spans, but things like // this filter the first pass for `tracing`: these are all the "profiling" spans, but things like
@ -63,20 +71,15 @@ pub fn init(spec: &str) -> tracing::subscriber::DefaultGuard {
None => true, None => true,
}; };
metadata.is_span() allowed
&& allowed && metadata.is_span()
&& metadata.level() >= &Level::INFO && metadata.level() >= &Level::INFO
&& !metadata.target().starts_with("salsa") && !metadata.target().starts_with("salsa")
&& metadata.name() != "compute_exhaustiveness_and_usefulness"
&& !metadata.target().starts_with("chalk") && !metadata.target().starts_with("chalk")
}); });
let layer = hprof::SpanTree::default() hprof::SpanTree::default().aggregate(true).spec_filter(write_filter).with_filter(profile_filter)
.aggregate(true)
.spec_filter(write_filter)
.with_filter(profile_filter);
let subscriber = Registry::default().with(layer);
tracing::subscriber::set_default(subscriber)
} }
#[derive(Default, Debug)] #[derive(Default, Debug)]

View File

@ -235,8 +235,19 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream
queries_with_storage.push(fn_name); queries_with_storage.push(fn_name);
let tracing = if let QueryStorage::Memoized = query.storage {
let s = format!("{trait_name}::{fn_name}");
Some(quote! {
let _p = tracing::span!(tracing::Level::DEBUG, #s, #(#key_names = tracing::field::debug(&#key_names)),*).entered();
})
} else {
None
}
.into_iter();
query_fn_definitions.extend(quote! { query_fn_definitions.extend(quote! {
fn #fn_name(&self, #(#key_names: #keys),*) -> #value { fn #fn_name(&self, #(#key_names: #keys),*) -> #value {
#(#tracing),*
// Create a shim to force the code to be monomorphized in the // Create a shim to force the code to be monomorphized in the
// query crate. Our experiments revealed that this makes a big // query crate. Our experiments revealed that this makes a big
// difference in total compilation time in rust-analyzer, though // difference in total compilation time in rust-analyzer, though

View File

@ -136,7 +136,7 @@ where
) -> std::fmt::Result { ) -> std::fmt::Result {
let slot_map = self.slot_map.read(); let slot_map = self.slot_map.read();
let key = slot_map.get_index(index as usize).unwrap().0; let key = slot_map.get_index(index as usize).unwrap().0;
write!(fmt, "{}({:?})", Q::QUERY_NAME, key) write!(fmt, "{}::{}({:?})", std::any::type_name::<Q>(), Q::QUERY_NAME, key)
} }
fn maybe_changed_after( fn maybe_changed_after(
@ -146,13 +146,13 @@ where
revision: Revision, revision: Revision,
) -> bool { ) -> bool {
debug_assert!(revision < db.salsa_runtime().current_revision()); debug_assert!(revision < db.salsa_runtime().current_revision());
let (key, slot) = {
let read = self.slot_map.read(); let read = self.slot_map.read();
let Some((key, slot)) = read.get_index(index as usize) else { let Some((key, slot)) = read.get_index(index as usize) else {
return false; return false;
}; };
let (key, slot) = (key.clone(), slot.clone()); (key.clone(), slot.clone())
// note: this drop is load-bearing. removing it would causes deadlocks. };
drop(read);
slot.maybe_changed_after(db, revision, &key) slot.maybe_changed_after(db, revision, &key)
} }

View File

@ -171,8 +171,8 @@ fn cycle_memoized() {
let cycle = extract_cycle(|| db.memoized_a()); let cycle = extract_cycle(|| db.memoized_a());
expect![[r#" expect![[r#"
[ [
"memoized_a(())", "cycles::MemoizedAQuery::memoized_a(())",
"memoized_b(())", "cycles::MemoizedBQuery::memoized_b(())",
] ]
"#]] "#]]
.assert_debug_eq(&cycle.unexpected_participants(&db)); .assert_debug_eq(&cycle.unexpected_participants(&db));
@ -184,8 +184,8 @@ fn cycle_volatile() {
let cycle = extract_cycle(|| db.volatile_a()); let cycle = extract_cycle(|| db.volatile_a());
expect![[r#" expect![[r#"
[ [
"volatile_a(())", "cycles::VolatileAQuery::volatile_a(())",
"volatile_b(())", "cycles::VolatileBQuery::volatile_b(())",
] ]
"#]] "#]]
.assert_debug_eq(&cycle.unexpected_participants(&db)); .assert_debug_eq(&cycle.unexpected_participants(&db));
@ -222,8 +222,8 @@ fn inner_cycle() {
let cycle = err.unwrap_err().cycle; let cycle = err.unwrap_err().cycle;
expect![[r#" expect![[r#"
[ [
"cycle_a(())", "cycles::CycleAQuery::cycle_a(())",
"cycle_b(())", "cycles::CycleBQuery::cycle_b(())",
] ]
"#]] "#]]
.assert_debug_eq(&cycle); .assert_debug_eq(&cycle);
@ -262,8 +262,8 @@ fn cycle_revalidate_unchanged_twice() {
Err( Err(
Error { Error {
cycle: [ cycle: [
"cycle_a(())", "cycles::CycleAQuery::cycle_a(())",
"cycle_b(())", "cycles::CycleBQuery::cycle_b(())",
], ],
}, },
) )
@ -344,8 +344,8 @@ fn cycle_mixed_1() {
Err( Err(
Error { Error {
cycle: [ cycle: [
"cycle_b(())", "cycles::CycleBQuery::cycle_b(())",
"cycle_c(())", "cycles::CycleCQuery::cycle_c(())",
], ],
}, },
) )
@ -371,9 +371,9 @@ fn cycle_mixed_2() {
Err( Err(
Error { Error {
cycle: [ cycle: [
"cycle_a(())", "cycles::CycleAQuery::cycle_a(())",
"cycle_b(())", "cycles::CycleBQuery::cycle_b(())",
"cycle_c(())", "cycles::CycleCQuery::cycle_c(())",
], ],
}, },
) )
@ -400,16 +400,16 @@ fn cycle_deterministic_order() {
Err( Err(
Error { Error {
cycle: [ cycle: [
"cycle_a(())", "cycles::CycleAQuery::cycle_a(())",
"cycle_b(())", "cycles::CycleBQuery::cycle_b(())",
], ],
}, },
), ),
Err( Err(
Error { Error {
cycle: [ cycle: [
"cycle_a(())", "cycles::CycleAQuery::cycle_a(())",
"cycle_b(())", "cycles::CycleBQuery::cycle_b(())",
], ],
}, },
), ),
@ -445,24 +445,24 @@ fn cycle_multiple() {
Err( Err(
Error { Error {
cycle: [ cycle: [
"cycle_a(())", "cycles::CycleAQuery::cycle_a(())",
"cycle_b(())", "cycles::CycleBQuery::cycle_b(())",
], ],
}, },
), ),
Err( Err(
Error { Error {
cycle: [ cycle: [
"cycle_a(())", "cycles::CycleAQuery::cycle_a(())",
"cycle_b(())", "cycles::CycleBQuery::cycle_b(())",
], ],
}, },
), ),
Err( Err(
Error { Error {
cycle: [ cycle: [
"cycle_a(())", "cycles::CycleAQuery::cycle_a(())",
"cycle_b(())", "cycles::CycleBQuery::cycle_b(())",
], ],
}, },
), ),
@ -485,7 +485,7 @@ fn cycle_recovery_set_but_not_participating() {
let r = extract_cycle(|| drop(db.cycle_a())); let r = extract_cycle(|| drop(db.cycle_a()));
expect![[r#" expect![[r#"
[ [
"cycle_c(())", "cycles::CycleCQuery::cycle_c(())",
] ]
"#]] "#]]
.assert_debug_eq(&r.all_participants(&db)); .assert_debug_eq(&r.all_participants(&db));

View File

@ -103,10 +103,10 @@ fn on_demand_input_durability() {
expect_test::expect![[r#" expect_test::expect![[r#"
RefCell { RefCell {
value: [ value: [
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: b(1) } }", "Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: on_demand_inputs::BQuery::b(1) } }",
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: a(1) } }", "Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: on_demand_inputs::AQuery::a(1) } }",
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: b(2) } }", "Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: on_demand_inputs::BQuery::b(2) } }",
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: a(2) } }", "Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: on_demand_inputs::AQuery::a(2) } }",
], ],
} }
"#]].assert_debug_eq(&events); "#]].assert_debug_eq(&events);
@ -119,11 +119,11 @@ fn on_demand_input_durability() {
expect_test::expect![[r#" expect_test::expect![[r#"
RefCell { RefCell {
value: [ value: [
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: c(1) } }", "Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: on_demand_inputs::CQuery::c(1) } }",
"Event { runtime_id: RuntimeId { counter: 0 }, kind: DidValidateMemoizedValue { database_key: b(1) } }", "Event { runtime_id: RuntimeId { counter: 0 }, kind: DidValidateMemoizedValue { database_key: on_demand_inputs::BQuery::b(1) } }",
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: c(2) } }", "Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: on_demand_inputs::CQuery::c(2) } }",
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: a(2) } }", "Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: on_demand_inputs::AQuery::a(2) } }",
"Event { runtime_id: RuntimeId { counter: 0 }, kind: DidValidateMemoizedValue { database_key: b(2) } }", "Event { runtime_id: RuntimeId { counter: 0 }, kind: DidValidateMemoizedValue { database_key: on_demand_inputs::BQuery::b(2) } }",
], ],
} }
"#]].assert_debug_eq(&events); "#]].assert_debug_eq(&events);
@ -137,10 +137,10 @@ fn on_demand_input_durability() {
expect_test::expect![[r#" expect_test::expect![[r#"
RefCell { RefCell {
value: [ value: [
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: a(1) } }", "Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: on_demand_inputs::AQuery::a(1) } }",
"Event { runtime_id: RuntimeId { counter: 0 }, kind: DidValidateMemoizedValue { database_key: c(1) } }", "Event { runtime_id: RuntimeId { counter: 0 }, kind: DidValidateMemoizedValue { database_key: on_demand_inputs::CQuery::c(1) } }",
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: a(2) } }", "Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: on_demand_inputs::AQuery::a(2) } }",
"Event { runtime_id: RuntimeId { counter: 0 }, kind: DidValidateMemoizedValue { database_key: c(2) } }", "Event { runtime_id: RuntimeId { counter: 0 }, kind: DidValidateMemoizedValue { database_key: on_demand_inputs::CQuery::c(2) } }",
], ],
} }
"#]].assert_debug_eq(&events); "#]].assert_debug_eq(&events);

View File

@ -27,8 +27,8 @@ fn parallel_cycle_none_recover() {
if let Some(c) = err_b.downcast_ref::<salsa::Cycle>() { if let Some(c) = err_b.downcast_ref::<salsa::Cycle>() {
expect![[r#" expect![[r#"
[ [
"a(-1)", "parallel::parallel_cycle_none_recover::AQuery::a(-1)",
"b(-1)", "parallel::parallel_cycle_none_recover::BQuery::b(-1)",
] ]
"#]] "#]]
.assert_debug_eq(&c.unexpected_participants(&db)); .assert_debug_eq(&c.unexpected_participants(&db));