salsa-rs / salsa

A generic framework for on-demand, incrementalized computation. Inspired by adapton, glimmer, and rustc's query system.
https://salsa-rs.netlify.app/
Apache License 2.0
2.1k stars 143 forks source link

`non_local_definitions` warning causes issues #547

Closed obsgolem closed 1 month ago

obsgolem commented 1 month ago

For example:

error: non-local `impl` definition, they should be avoided as they go against expectation
  --> tests\warnings\needless_lifetimes.rs:18:1
   |
18 | #[salsa::tracked(return_ref)]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: move this `impl` block outside the of the current function `use_tree`
   = note: an `impl` definition is non-local if it is nested inside an item and may impact type checking outside of that item. This can be the case if neither the trait or the self type are at the same nesting level as the `impl`
   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type  
   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>   
   = note: the macro `salsa::plumbing::setup_tracked_fn` may come from an old version of the `salsa_macro_rules` crate, try updating your dependency with `cargo update -p salsa_macro_rules`
   = note: this error originates in the macro `salsa::plumbing::setup_tracked_fn` which comes from the expansion of the attribute macro `salsa::tracked` (in Nightly builds, run with -Z macro-backtrace for more info)