-
Notifications
You must be signed in to change notification settings - Fork 186
Closed
Description
A tracked trait impl give inner_fn_name_
as ingredient debug name. We should pick the name of the original trait impl, not the InnerTrait
trait impl generated by salsa::tracked
macro.
#[salsa::db]
struct Database;
#[salsa::db]
impl salsa::Database for Database {
fn salsa_event(&self, event: &dyn Fn() -> salsa::Event) {
let event = event();
if let salsa::EventKind::WillExecute { database_key } = event.kind {
dbg!(self.ingredient_debug_name(database_key.ingredient_index()));
}
}
}
/// Given a tracked trait impl (which is implemented for some tracked input or tracked struct).
#[salsa::tracked]
impl MyTrait for MyStruct {
#[salsa::tracked]
fn parse(self, db: &dyn salsa::Database) -> Something<'_> {
// impl
}
}
/// EXPANDED
///
/// The macro generate this InnerTrait code, which take over `parse`,
/// when resolving the ingredient_debug_name.
/// All tracked trait impl result in this uninformative `inner_fn_name_`.
/// `<MyStruct as MyTrait>::parse` would be the best possible debug name output,
/// or `parse` or `MyTrait::parse`, but that would make it harder to distinguish multiple trait implementors.
trait InnerTrait_ {
fn inner_fn_name_(self, db: &dyn salsa::Database) -> Something<'_>;
}
impl InnerTrait_ for SourceFile {
fn inner_fn_name_(self, db: &dyn salsa::Database) -> Something<'_> {
// impl
}
}
Metadata
Metadata
Assignees
Labels
No labels