File tree 3 files changed +9
-0
lines changed
3 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -301,6 +301,7 @@ impl CodegenBackend for LlvmCodegenBackend {
301
301
}
302
302
303
303
if sess. opts . debugging_opts . no_link {
304
+ // FIXME: use a binary format to encode the `.rlink` file
304
305
let rlink_data = json:: encode ( & codegen_results) . map_err ( |err| {
305
306
sess. fatal ( & format ! ( "failed to encode rlink: {}" , err) ) ;
306
307
} ) ?;
Original file line number Diff line number Diff line change @@ -117,6 +117,12 @@ bitflags::bitflags! {
117
117
}
118
118
119
119
/// Misc info we load from metadata to persist beyond the tcx.
120
+ /// Note: though `CrateNum` is only meaningful within the same tcx, information within `CrateInfo`
121
+ /// is self-contained. `CrateNum` can be viewed as a unique identifier within a `CrateInfo`, where
122
+ /// `used_crate_source` contains all `CrateSource` of the dependents, and maintains a mapping from
123
+ /// identifiers (`CrateNum`) to `CrateSource`. The other fields map `CrateNum` to the crate's own
124
+ /// additional properties, so that effectively we can retrieve each dependent crate's `CrateSource`
125
+ /// and the corresponding properties without referencing information outside of a `CrateInfo`.
120
126
#[ derive( Debug , RustcEncodable , RustcDecodable ) ]
121
127
pub struct CrateInfo {
122
128
pub panic_runtime : Option < CrateNum > ,
Original file line number Diff line number Diff line change @@ -87,6 +87,8 @@ impl fmt::Display for CrateNum {
87
87
}
88
88
}
89
89
90
+ /// As a local identifier, a `CrateNum` is only meaningful within its context, e.g. within a tcx.
91
+ /// Therefore, make sure to include the context when encode a `CrateNum`.
90
92
impl rustc_serialize:: UseSpecializedEncodable for CrateNum {
91
93
fn default_encode < E : Encoder > ( & self , e : & mut E ) -> Result < ( ) , E :: Error > {
92
94
e. emit_u32 ( self . as_u32 ( ) )
You can’t perform that action at this time.
0 commit comments