Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DebugWithDb in multi-crate Salsa projects #509

Closed
wants to merge 4 commits into from

Commits on Jun 20, 2024

  1. Fix DebugWithDb in multi-crate Salsa projects

    Previously, the auto-generated impls hard-coded the database's type to
    be `&dyn Db`, with `Db` being the local crate's database. Due to
    limitations of trait upcasting, this meant that Salsa structs containing
    Salsa structs from multiple different crates would not be printed
    properly. They would fallback to the plain `std::fmt::Debug` impl, which
    just prints an ID -- not very useful.
    
    Now, the impls are generic over the database type. Any database that
    implements the local database trait will be accepted.
    
    For more background, see this Zulip conversation [1].
    
    [1]: https://salsa.zulipchat.com/#narrow/stream/145099-general/topic/recursive.20DebugWithDb.3F
    camelid committed Jun 20, 2024
    Configuration menu
    Copy the full SHA
    842e0a9 View commit details
    Browse the repository at this point in the history
  2. Make finding __salsa_crate_Db robust to Jar location

    Unfortunately, this regresses some unrelated error messages.
    camelid committed Jun 20, 2024
    Configuration menu
    Copy the full SHA
    72dc9d5 View commit details
    Browse the repository at this point in the history

Commits on Jun 25, 2024

  1. Use absolute path

    The new auto-impl for `DebugWithDb` caused this error message to
    regress because it expects the `__salsa_crate_Db` to be in the same
    location as the `Jar`. This fixes it by using an absolute path. Note
    that using custom `Jar` locations wasn't supported properly before
    either.
    camelid committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    92d13b0 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    75a6ca3 View commit details
    Browse the repository at this point in the history