Skip to content
This repository has been archived by the owner on Mar 1, 2019. It is now read-only.

Add crate disambiguators #11

Merged
merged 3 commits into from
Oct 27, 2017
Merged

Add crate disambiguators #11

merged 3 commits into from
Oct 27, 2017

Conversation

Xanewok
Copy link
Collaborator

@Xanewok Xanewok commented Oct 21, 2017

Needed for rust-dev-tools/rls-analysis#93.

This allows to distinguish between different versions of a crate or
different crate targets such as bin or lib.

Will make a PR with changes to librustc_save_analysis generation after a new version with these changes will be published.

This allows to distinguish between different versions of a crate or
different crate targets such as bin or lib.
src/lib.rs Outdated
#[derive(Debug, Clone, RustcDecodable, RustcEncodable, PartialEq, Eq, Hash)]
pub struct GlobalCrateId {
pub name: String,
pub disambiguator: String,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you document what the disambiguator looks like please? What are the valid values?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nrc so the disambiguator was changed internally from a hex-string to a 128 bit number (Fingerprint(u64, u64), here), as it was effectively a hex-formatted 128 bit value in a string.
Should I change it to use a u128 or (u64, u64) here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't see where Fingerprint was defined. Ideally, you would use FingerPrint here, but that would probably mean pulling it into rls-data which might not be practical. If FingerPrint is defined as (u64, u64) then I'd use that, otherwise u128.

@nrc nrc merged commit 64cc7c2 into rust-dev-tools:master Oct 27, 2017
@nrc
Copy link
Member

nrc commented Oct 27, 2017

Published as 0.12

bors added a commit to rust-lang/rust that referenced this pull request Nov 2, 2017
Emit crate disambiguators in save-analysis data

Needed for rust-dev-tools/rls-analysis#93.
Blocked by rust-dev-tools/rls-data#11. (For now, this pulls my branch [rls-data/crate-source](https://github.com/Xanewok/rls-data/tree/crate-source))

This will allow to disambiguate different crates types/versions when indexing resulting save-analysis data (most importantly allow to support bin+lib and different crate versions).

r? @nrc
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants