-
Notifications
You must be signed in to change notification settings - Fork 67
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
Basic rust indexing support. #50
Conversation
b8a0575
to
f9fa996
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really nice.
tools/src/bin/rust-indexer.rs
Outdated
@@ -0,0 +1,235 @@ | |||
#[macro_use] | |||
extern crate clap; | |||
extern crate rls_analysis as analysis; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's kind of confusing to do this since there's already an analysis module in tools. Can you leave it as rls_analysis?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing, done.
tools/src/bin/rust-indexer.rs
Outdated
if span.column_start == span.column_end { | ||
return format!("{}:{}", span.line_start.0, span.column_start.0 - 1); | ||
} | ||
let len = span.column_end.0 - span.column_end.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, fixed it.
tools/src/bin/rust-indexer.rs
Outdated
return format!("{}:{}", span.line_start.0, span.column_start.0 - 1); | ||
} | ||
let len = span.column_end.0 - span.column_end.0; | ||
format!("{}:{}-{}", span.line_start.0, span.column_start.0 - 1, len) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In any case, the last argument should actually be span.column_end.0 - 1
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, that was the fix, thanks! :)
tools/src/bin/rust-indexer.rs
Outdated
.args_from_usage( | ||
"<src> 'Points to the source root' | ||
<input> 'Points to the deps/save-analysis directory' | ||
<output> 'Points to the directory where searchfox metadata should'", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where searchfox metadata should go?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch :)
I'm trying to run it on central... though it may take a bit :) |
I added a couple more commits that make this work in mozilla-central. r? @bill-mccloskey |
I tried running this locally on mozilla-central, and I got a segfault while building some Rust code. This was the error. 14:11.94 error: failed to run custom build command for Everything else finished successfully, but I didn't get any indexing results for WebRender or Stylo. Some crates did have data, though (libcubeb and a few other things). Did you see anything like this, Emilio? |
The same thing happens without the -Zsave-analysis option. I wonder if the current Rust nightly is just unable to build Firefox right now? Or maybe it's an issue running inside Vagrant? |
I did have one idea about how to address the issue of how to land this at the same time we want to index C++ code in TaskCluster. It looks like running |
The issue you're seeing is rust-lang/rust#46239. I'm landing a workaround in mozilla-central right now. |
That sounds ok to me, how's the taskcluster stuff happening? I'm happy to try to integrate it that way too. |
Do you actually want my review on anything here? |
I guess billm's review is enough |
This will be needed to use -Zsave-analysis.
Don't run it yet, since I haven't tested it on mozilla-central.
This commit implements the necessary translation from local crate IDs to global crate IDs, so that cross-references work properly across crates.
They don't work well right now, but hey, worth testing it.
This allows the script to run on central.
Unfortunate, but this happens when indexing the `future` crate. I haven't debugged it further, but it was in builtin definitions that don't have symbols anyway.
It now works on mozilla-central!
Rebased and verified it still works. The failure on central was fixed long ago, too. |
@emilio are there any other changes you want to make here? I looked over the changes (not in much detail though) and they look sane, at least to the point where I'm comfortable merging them and iterating further afterwards. I also created new AMIs with the nightly rust and ran an indexing run with these patches, so the instance up on dev.searchfox.org right now has these changes and they seem to work fine. So if you have no objections I'd like to merge these patches (and deploy the new AMIs as default). |
That'd be great! IIRC @bill-mccloskey mentioned that this was blocked on some kind of infra issue regarding reprovisioning, but if you managed to get it working I think this is good to go. |
I've deployed the reprovisioned servers to indexer-16.04 and web-server-16.04 so I think merging these patches should work for tomorrow's indexing run. If something goes wrong I'll investigate. |
Don't run it yet by default, since I haven't tested it on mozilla-central.