@@ -81,6 +81,16 @@ pub struct Id {
81
81
pub index : u32 ,
82
82
}
83
83
84
+ /// Crate name, along with its disambiguator (128-bit hash) represents a globally
85
+ /// unique crate identifier, which should allow for differentiation between
86
+ /// different crate targets or versions and should point to the same crate when
87
+ /// pulled by different other, dependent crates.
88
+ #[ derive( Debug , Clone , RustcDecodable , RustcEncodable , PartialEq , Eq , Hash ) ]
89
+ pub struct GlobalCrateId {
90
+ pub name : String ,
91
+ pub disambiguator : ( u64 , u64 ) ,
92
+ }
93
+
84
94
#[ derive( Debug , Clone , RustcDecodable , RustcEncodable ) ]
85
95
pub struct SpanData {
86
96
pub file_name : PathBuf ,
@@ -95,7 +105,7 @@ pub struct SpanData {
95
105
96
106
#[ derive( Debug , Clone , RustcDecodable , RustcEncodable ) ]
97
107
pub struct CratePreludeData {
98
- pub crate_name : String ,
108
+ pub crate_id : GlobalCrateId ,
99
109
pub crate_root : String ,
100
110
pub external_crates : Vec < ExternalCrateData > ,
101
111
pub span : SpanData ,
@@ -104,9 +114,13 @@ pub struct CratePreludeData {
104
114
/// Data for external crates in the prelude of a crate.
105
115
#[ derive( Debug , Clone , RustcDecodable , RustcEncodable ) ]
106
116
pub struct ExternalCrateData {
107
- pub name : String ,
108
- pub num : u32 ,
117
+ /// Source file where the external crate is declared.
109
118
pub file_name : String ,
119
+ /// A crate-local crate index of an external crate. Local crate index is
120
+ /// always 0, so these should start from 1 and range should be contiguous,
121
+ /// e.g. from 1 to n for n external crates.
122
+ pub num : u32 ,
123
+ pub id : GlobalCrateId ,
110
124
}
111
125
112
126
#[ derive( Debug , Clone , RustcDecodable , RustcEncodable ) ]
0 commit comments