File tree Expand file tree Collapse file tree 3 files changed +9
-0
lines changed Expand file tree Collapse file tree 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 {
301301 }
302302
303303 if sess. opts . debugging_opts . no_link {
304+ // FIXME: use a binary format to encode the `.rlink` file
304305 let rlink_data = json:: encode ( & codegen_results) . map_err ( |err| {
305306 sess. fatal ( & format ! ( "failed to encode rlink: {}" , err) ) ;
306307 } ) ?;
Original file line number Diff line number Diff line change @@ -117,6 +117,12 @@ bitflags::bitflags! {
117117}
118118
119119/// 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`.
120126#[ derive( Debug , RustcEncodable , RustcDecodable ) ]
121127pub struct CrateInfo {
122128 pub panic_runtime : Option < CrateNum > ,
Original file line number Diff line number Diff line change @@ -87,6 +87,8 @@ impl fmt::Display for CrateNum {
8787 }
8888}
8989
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`.
9092impl rustc_serialize:: UseSpecializedEncodable for CrateNum {
9193 fn default_encode < E : Encoder > ( & self , e : & mut E ) -> Result < ( ) , E :: Error > {
9294 e. emit_u32 ( self . as_u32 ( ) )
You can’t perform that action at this time.
0 commit comments