-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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: ensure that the parent of a SourceRoot cannot be itself #17381
Conversation
Could a circular reference occur here? For example:
This might cause Or perhaps for paths with a parent-child relationship within the same SourceRoot, we only consider the root path (which means r-a should exit the inner loop when |
We already depend on petgraph so we could just use a proper graph impl for this instead that then deals with accidental cycle handling if they can actually occur. Though this entire thing is very hacky in the first place... Thanks a lot for investigating! |
@lnicola we might wanna do a second release after this as today's release becomes mostly unusable for a bunch of people (and then there is also the random startup panics that I also (presumably) fixed this morning). If you have the time that is this week :) |
☀️ Test successful - checks-actions |
fix #17378.
In
FileSetConfig.map
, different roots might be mapped to the sameroot_id
due to deduplication inProjectFolders::new
:In
source_root_parent_map
, r-a might encounter paths where their SourceRootId (i.e.root_id
) is identical, yet one the them is the parent of the another. This situation can cause theroot_id
to be its own parent, potentially leading to an infinite loop.This PR resolves such cases by adding a check.