-
Couldn't load subscription status.
- Fork 190
Fix clippy::double_parens warnings in unexpected_cycle_recovery and unexpected_cycle_initial macros #1005
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
base: master
Are you sure you want to change the base?
Conversation
…nexpected_cycle_initial macros
✅ Deploy Preview for salsa-rs canceled.
|
CodSpeed Performance ReportMerging #1005 will degrade performances by 6.42%Comparing Summary
Benchmarks breakdown
|
|
Would you mind adding a test that triggers the problematic behavior (and wasn't fixed by #1001) |
I've encountered the problems in a project running on a nightly Rust after I've updated the toolchain to So, I've created a basic regression test with tracked functions that have no additional inputs beyond Then I've added a compile-time verification test in
This test fails in the P.S.: I don't know why adding tests affects performance benchmarks ;( P.P.S.: Miri test fails because of running
|
|
I'm not sure if I'm doing something wrong but I don't get the where See #1006 |
|
Yeah not sure. But I'd prefer if we get #1006 to fail before fixing it. |


Fixes #1004
In Nightly builds both
cycle_initialandrecover_from_cyclegenerateunnecessary parentheseswarnings when using#[salsa::tracked]macro and the tracked function doesn't use any additional inputs:The Problem:
In
components/salsa-macro-rules/src/unexpected_cycle_recovery.rs, both macros use this pattern:std::mem::drop(($($other_inputs,)*));that creates a tuple containing all$other_inputsand drops them.These macros are invoked from
components/salsa-macro-rules/src/setup_tracked_fn.rs:305-316:cycle_initialis called with:(db, $($input_id),*)recover_from_cycleis called with:(db, value, count, $($input_id),*)When
$other_inputsis empty (function has no additional inputs beyonddb), the expression($($other_inputs,)*)expands to()(an empty tuple), resulting in:std::mem::drop(())and it triggers clippy warnings.The Fix:
Instead of creating a tuple and dropping it, we should repeat dropping each input individually:
std::mem::drop(($($other_inputs,)*));$(std::mem::drop($other_inputs);)*