Skip to content
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

feat(rust_indexer): add flag to disable emitting xrefs for stdlib #5197

Merged
merged 3 commits into from
Jan 27, 2022

Conversation

wcalandro
Copy link
Contributor

Open Source Code Search has a strange bug where, occasionally, anchors for cross-references can be clickable even when the definition node (including an anchor node) for the target of the cross reference does not exist. Clicking the cross reference anchor brings up the References panel which shows an error because the definition node does not exist (we don't index the Rust standard library, so we can't emit definition nodes and anchors for it). An example of this is here: https://cs.opensource.google/fuchsia/fuchsia/+/main:src/connectivity/network/dns/src/main.rs;l=30;bpv=0;bpt=1 (hover over the "std" and try clicking on it)

This PR adds an optional flag to the Rust indexer that disables emitting any cross references to the standard library, which should mitigate this issue.

@wcalandro wcalandro requested a review from a team January 26, 2022 23:28
@creachadair
Copy link
Contributor

This is a reasonable change, but it's worth noting for posterity that we originally considered this behaviour to be a feature, not a bug: Even if a definition site wasn't indexed, it can be useful for the user to see xrefs for other uses of the same thing.

(Internal CodeSearch didn't cope with this super gracefully, as it was oriented toward definition sites—but the open-source UI seems to provide an option)

@jaysachs
Copy link
Contributor

This is a reasonable change, but it's worth noting for posterity that we originally considered this behaviour to be a feature, not a bug: Even if a definition site wasn't indexed, it can be useful for the user to see xrefs for other uses of the same thing.

(Internal CodeSearch didn't cope with this super gracefully, as it was oriented toward definition sites—but the open-source UI seems to provide an option)

That's true in general. For reasons we haven't determined yet, we're not seeing cross references for that symbol. Also note that due to constraints on the current Rust indexer implementation, we don't get all std references during indexing.

Arguably, the utility of finding "uses of the std crate" is low, so in this specific case there seems to be no huge loss.

Ideally, in the fullness of time, we'll index the Rust stdlib and then this flag will just be off permanently. (And also figure out the bug in the UI pathways.)

@wcalandro wcalandro merged commit 1aa5b94 into kythe:master Jan 27, 2022
@wcalandro wcalandro deleted the rust-std-lib branch January 27, 2022 20:08
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.

None yet

3 participants