fix(rust_analyzer): revert is_library regression #3198
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In #2995, root check is replaced with
is_descendant
. Author of the PR then figured out issue was unrelated to the way root is checked, but kept the new implementation because it was descriptive on what it does. But on Windows, this causes the issue that #2645 is_library fixes.So the issue is,
is_descendant
function callstraverse_parents
, which converts the path using:Which, in a Windows environment, this converts UNIX paths to Windows paths. So this requires items in line 27 to be also converted. BUT that doesn't work because
dirname
is not able to work with Windows paths. So I guess this is a bigger issue on Windows support, but I don't know the codebase enough to change how utils work and have that responsibility.So, if that's it, why isn't this an issue and a PR instead. Because I think
is_descendant
is wrong tool here. For valid cases of items there, substring check is exact and does it in a way simpler way. I also added a comment above to make it descriptive on what it does. So this essentially reverts part of #2995 that changes how descendant is checked and adds a comment.