-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add command to report unresolved references #17904
Conversation
This isn't quite working totally yet, but opening the PR to get some feedback and ask a couple questions. The approach is based on This is the output when running on rust-analyzer itself: https://gist.github.com/darichey/55e411f55b722d9cc1602e8f273c1a67 It does find some actual issues! e.g.,
However, there's a lot of false positives. In particular, code within Also, as reported in #10935, proc macro attributes are unresolved. Should we copy the hack for highlighting in #10937 or keep them since they are technically unresolved? |
faf8af0
to
80357b8
Compare
I've fixed the handling of macros and decided to ignore attributes. This is the new output when running on rust-analyzer: https://gist.github.com/darichey/2f74b0e45f5c1ff18d4ea78039e2c831 All of those are correctly-identified unresolved references except the last one: rust-analyzer/crates/cfg/src/tests.rs Line 248 in 9b72445
I assume it has something to do with the conditional deriving of Arbitrary, Other than that issue, I think this is ready for review. |
Had a quick look but I am also not sure why that is. Either way commited some small cleansups and fixes (maybe that fixes things though I doubt it) |
18707cc
to
57c29eb
Compare
57c29eb
to
e602e01
Compare
Figured it out! We need to set For now, I've switched to creating the With that, there are no more false positives in rust-analyzer: https://gist.github.com/darichey/10a7b13961216e680f0d6b1085f79ab5 I will run it on our monorepo to check for any more false positives, but I think this is a good start we can iterate on! |
@bors r+ |
☀️ Test successful - checks-actions |
Adds
rust-analyzer unresolved-references
which reports unresolved references. This is useful for debugging and regression testing for both rust-analyzer and project generators like Buck's rust-project.As discussed: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Command.20to.20report.20unresolved.20references