salsa/salsa-2022-tests/tests/warnings/needless_borrow.rs
Niko Matsakis 389aa66bcf print all fields in debug() but ignore deps
In a previous PR we added the `include_all_fields`
parameter to `DebugWithDb` to allow it to
not create spurious dependencies.

This PR takes a different approach: we simply
ignore the dependencies created during debug
operations. This is risky as it can create
incorrect dependencies, but it is way more
convenient and seems like what users probably
want.

It also means that `DebugWithDb` has a simpler
signature that matches the `Debug` trait again,
which seems good to me.
2024-04-03 05:59:11 -04:00

19 lines
410 B
Rust

trait Db: salsa::DbWithJar<Jar> {}
#[salsa::jar(db = Db)]
struct Jar(TokenTree);
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
enum Token {}
impl salsa::DebugWithDb<dyn Db + '_> for Token {
fn fmt(&self, _f: &mut std::fmt::Formatter<'_>, _db: &dyn Db) -> std::fmt::Result {
unreachable!()
}
}
#[salsa::tracked(jar = Jar)]
struct TokenTree {
#[return_ref]
tokens: Vec<Token>,
}