Skip to content

Add failing test for cycle revalidation #257

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

Closed
wants to merge 1 commit into from

Conversation

flodiebold
Copy link
Contributor

The following test hits the unwrap in runtime.rs:415. I encountered this panic while working on rust-analyzer.

As far as I understand, report_unexpected_cycle assumes the query we hit the cycle on has to be executing right now, but that's not the case here: it's just being revalidated (through validate_memoized_value). I'm not sure what the correct way to handle this is?

flodiebold added a commit to flodiebold/rust-analyzer that referenced this pull request Mar 21, 2021
This allows us to handle more cases without a query cycle, which
includes certain cases that rustc accepted. That in turn means we avoid
triggering salsa-rs/salsa#257 on valid code (it will still happen if the
user writes an actual cycle).

We actually accept more definitions than rustc now; that's because rustc
only ignores bindings when looking up super traits, whereas we now also
ignore them when looking for predicates to disambiguate associated type
shorthand. We could introduce a separate query for super traits if
necessary, but for now I think this should be fine.
flodiebold added a commit to flodiebold/rust-analyzer that referenced this pull request Mar 21, 2021
This allows us to handle more cases without a query cycle, which
includes certain cases that rustc accepted. That in turn means we avoid
triggering salsa-rs/salsa#257 on valid code (it will still happen if the
user writes an actual cycle).

We actually accept more definitions than rustc now; that's because rustc
only ignores bindings when looking up super traits, whereas we now also
ignore them when looking for predicates to disambiguate associated type
shorthand. We could introduce a separate query for super traits if
necessary, but for now I think this should be fine.
bors bot added a commit to rust-lang/rust-analyzer that referenced this pull request Mar 21, 2021
8133: Ignore type bindings in generic_predicates_for_param (fix panic on ena and crates depending on it) r=flodiebold a=flodiebold

This allows us to handle more cases without a query cycle, which includes certain cases that rustc accepted. That in turn means we avoid triggering salsa-rs/salsa#257 on valid code (it will still happen if the user writes an actual cycle).

We actually accept more definitions than rustc now; that's because rustc only ignores bindings when looking up super traits, whereas we now also ignore them when looking for predicates to disambiguate associated type shorthand. We could introduce a separate query for super traits if necessary, but for now I think this should be fine.

Co-authored-by: Florian Diebold <[email protected]>
@nikomatsakis
Copy link
Member

Hmm. I dont' have time to think hard about this right now (working through notifications) but I'll try to ping on salsa zulip

@matklad
Copy link
Member

matklad commented Apr 27, 2021

cc #147, the PR that added support for cycles, and also cc @Marwes (I wonder if you might see this panic in gluon's impors as well?)

@nikomatsakis
Copy link
Member

We've fixed the bugs here and I think we have good test coverage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants