]> git.proxmox.com Git - rustc.git/blobdiff - src/vendor/rls-data/src/lib.rs
New upstream version 1.23.0+dfsg1
[rustc.git] / src / vendor / rls-data / src / lib.rs
index 93aff9577cf15f2a507c21dbced457ed9912099a..830bb23a13dd9b56d7e314a760a5b6c41179b887 100644 (file)
@@ -81,6 +81,16 @@ pub struct Id {
     pub index: u32,
 }
 
+/// Crate name, along with its disambiguator (128-bit hash) represents a globally
+/// unique crate identifier, which should allow for differentiation between
+/// different crate targets or versions and should point to the same crate when
+/// pulled by different other, dependent crates.
+#[derive(Debug, Clone, RustcDecodable, RustcEncodable, PartialEq, Eq, Hash)]
+pub struct GlobalCrateId {
+    pub name: String,
+    pub disambiguator: (u64, u64),
+}
+
 #[derive(Debug, Clone, RustcDecodable, RustcEncodable)]
 pub struct SpanData {
     pub file_name: PathBuf,
@@ -95,7 +105,7 @@ pub struct SpanData {
 
 #[derive(Debug, Clone, RustcDecodable, RustcEncodable)]
 pub struct CratePreludeData {
-    pub crate_name: String,
+    pub crate_id: GlobalCrateId,
     pub crate_root: String,
     pub external_crates: Vec<ExternalCrateData>,
     pub span: SpanData,
@@ -104,9 +114,13 @@ pub struct CratePreludeData {
 /// Data for external crates in the prelude of a crate.
 #[derive(Debug, Clone, RustcDecodable, RustcEncodable)]
 pub struct ExternalCrateData {
-    pub name: String,
-    pub num: u32,
+    /// Source file where the external crate is declared.
     pub file_name: String,
+    /// A crate-local crate index of an external crate. Local crate index is
+    /// always 0, so these should start from 1 and range should be contiguous,
+    /// e.g. from 1 to n for n external crates.
+    pub num: u32,
+    pub id: GlobalCrateId,
 }
 
 #[derive(Debug, Clone, RustcDecodable, RustcEncodable)]
@@ -146,8 +160,12 @@ pub enum DefKind {
     // value = variant names
     Enum,
     // value = enum name + variant name + types
+    TupleVariant,
+    // value = enum name + name + fields
+    StructVariant,
+    // value = variant name + types
     Tuple,
-    // value = [enum name +] name + fields
+    // value = name + fields
     Struct,
     Union,
     // value = signature
@@ -167,6 +185,8 @@ pub enum DefKind {
     Static,
     Const,
     Field,
+    // no value
+    ExternType,
 }
 
 #[derive(Debug, Clone, RustcDecodable, RustcEncodable)]