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

Fix translation of external spans #42507

Merged
merged 1 commit into from
Jun 9, 2017

Conversation

ibabushkin
Copy link
Contributor

Previously, I noticed that spans from external crates don't generate any output. This limitation is problematic if analysis is performed on one or more external crates, as is the case with rust-semverver. This change should address this behaviour, with the potential drawback that a minor performance hit is to be expected, as spans from potentially large crates have to be translated now.

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @arielb1 (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@eddyb
Copy link
Member

eddyb commented Jun 7, 2017

@bors r+

@bors
Copy link
Contributor

bors commented Jun 7, 2017

📌 Commit 9a054f2 has been approved by eddyb

@aidanhs aidanhs added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jun 7, 2017
@bors
Copy link
Contributor

bors commented Jun 9, 2017

⌛ Testing commit 9a054f2 with merge 20b80ac...

@bors
Copy link
Contributor

bors commented Jun 9, 2017

💔 Test failed - status-travis

@eddyb
Copy link
Member

eddyb commented Jun 9, 2017

@bors retry

@bors
Copy link
Contributor

bors commented Jun 9, 2017

⌛ Testing commit 9a054f2 with merge 5fe923d...

bors added a commit that referenced this pull request Jun 9, 2017
Fix translation of external spans

Previously, I noticed that spans from external crates don't generate any output. This limitation is problematic if analysis is performed on one or more external crates, as is the case with [rust-semverver](https://github.com/ibabushkin/rust-semverver). This change should address this behaviour, with the potential drawback that a minor performance hit is to be expected, as spans from potentially large crates have to be translated now.
@bors
Copy link
Contributor

bors commented Jun 9, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: eddyb
Pushing 5fe923d to master...

@bors bors merged commit 9a054f2 into rust-lang:master Jun 9, 2017
andersk added a commit to andersk/rust-clippy that referenced this pull request Jun 10, 2017
bors added a commit that referenced this pull request Jun 18, 2017
Implement lazy loading of external crates' sources. Fixes #38875

Fixes #38875. This is a follow-up to #42507. When a (now correctly translated) span from an external crate is referenced in a error, warning or info message, we still don't have the source code being referenced.
Since stuffing the source in the serialized metadata of an rlib is extremely wasteful, the following scheme has been implemented:

* File maps now contain a source hash that gets serialized as well.
* When a span is rendered in a message, the source hash in the corresponding file map(s) is used to try and load the source from the corresponding file on disk. If the file is not found or the hashes don't match, the failed attempt is recorded (and not retried).
* The machinery fetching source lines from file maps is augmented to use the lazily loaded external source as a secondary fallback for file maps belonging to external crates.

This required a small change to the expected stderr of one UI test (it now renders a span, where previously was none).

Further work can be done based on this - some of the machinery previously used to hide external spans is possibly obsolete and the hashing code can be reused in different places as well.

r? @eddyb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants