Skip to content

Commit 4c2f3ff

Browse files
committed
remove the "misc-items" from meta-data
It was duplicating information available elsewhere.
1 parent 2a84449 commit 4c2f3ff

File tree

3 files changed

+9
-41
lines changed

3 files changed

+9
-41
lines changed

src/librustc_metadata/common.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,9 @@ pub const tag_items_data_item_visibility: usize = 0x78;
149149
pub const tag_items_data_item_inherent_impl: usize = 0x79;
150150
// GAP 0x7a
151151
pub const tag_mod_child: usize = 0x7b;
152-
pub const tag_misc_info: usize = 0x108; // top-level only
153-
pub const tag_misc_info_crate_items: usize = 0x7c;
152+
// GAP 0x7c
154153

154+
// GAP 0x108
155155
pub const tag_impls: usize = 0x109; // top-level only
156156
pub const tag_impls_trait: usize = 0x7d;
157157
pub const tag_impls_trait_impl: usize = 0x7e;

src/librustc_metadata/decoder.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use index;
2323
use tls_context;
2424
use tydecode::TyDecoder;
2525

26+
use rustc::hir::def_id::CRATE_DEF_INDEX;
2627
use rustc::hir::svh::Svh;
2728
use rustc::hir::map as hir_map;
2829
use rustc::hir::map::DefKey;
@@ -732,15 +733,7 @@ pub fn each_top_level_item_of_crate<F, G>(cdata: Cmd, get_crate_data: G, callbac
732733
where F: FnMut(DefLike, ast::Name, ty::Visibility),
733734
G: FnMut(ast::CrateNum) -> Rc<CrateMetadata>,
734735
{
735-
let root_doc = rbml::Doc::new(cdata.data());
736-
let misc_info_doc = reader::get_doc(root_doc, tag_misc_info);
737-
let crate_items_doc = reader::get_doc(misc_info_doc,
738-
tag_misc_info_crate_items);
739-
740-
each_child_of_item_or_crate(cdata,
741-
crate_items_doc,
742-
get_crate_data,
743-
callback)
736+
each_child_of_item(cdata, CRATE_DEF_INDEX, get_crate_data, callback)
744737
}
745738

746739
pub fn get_item_name(cdata: Cmd, id: DefIndex) -> ast::Name {

src/librustc_metadata/encoder.rs

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,30 +1693,6 @@ fn encode_impls<'a>(ecx: &'a EncodeContext,
16931693
rbml_w.end_tag();
16941694
}
16951695

1696-
fn encode_misc_info(ecx: &EncodeContext,
1697-
krate: &hir::Crate,
1698-
rbml_w: &mut Encoder) {
1699-
rbml_w.start_tag(tag_misc_info);
1700-
rbml_w.start_tag(tag_misc_info_crate_items);
1701-
for item_id in &krate.module.item_ids {
1702-
rbml_w.wr_tagged_u64(tag_mod_child,
1703-
def_to_u64(ecx.tcx.map.local_def_id(item_id.id)));
1704-
1705-
let item = ecx.tcx.map.expect_item(item_id.id);
1706-
each_auxiliary_node_id(item, |auxiliary_node_id| {
1707-
rbml_w.wr_tagged_u64(tag_mod_child,
1708-
def_to_u64(ecx.tcx.map.local_def_id(auxiliary_node_id)));
1709-
true
1710-
});
1711-
}
1712-
1713-
// Encode reexports for the root module.
1714-
encode_reexports(ecx, rbml_w, 0);
1715-
1716-
rbml_w.end_tag();
1717-
rbml_w.end_tag();
1718-
}
1719-
17201696
// Encodes all reachable symbols in this crate into the metadata.
17211697
//
17221698
// This pass is seeded off the reachability list calculated in the
@@ -1861,7 +1837,7 @@ fn encode_metadata_inner(rbml_w: &mut Encoder,
18611837
codemap_bytes: u64,
18621838
macro_defs_bytes: u64,
18631839
impl_bytes: u64,
1864-
misc_bytes: u64,
1840+
reachable_bytes: u64,
18651841
item_bytes: u64,
18661842
index_bytes: u64,
18671843
xref_bytes: u64,
@@ -1877,7 +1853,7 @@ fn encode_metadata_inner(rbml_w: &mut Encoder,
18771853
codemap_bytes: 0,
18781854
macro_defs_bytes: 0,
18791855
impl_bytes: 0,
1880-
misc_bytes: 0,
1856+
reachable_bytes: 0,
18811857
item_bytes: 0,
18821858
index_bytes: 0,
18831859
xref_bytes: 0,
@@ -1931,11 +1907,10 @@ fn encode_metadata_inner(rbml_w: &mut Encoder,
19311907
encode_impls(&ecx, krate, rbml_w);
19321908
stats.impl_bytes = rbml_w.writer.seek(SeekFrom::Current(0)).unwrap() - i;
19331909

1934-
// Encode miscellaneous info.
1910+
// Encode reachability info.
19351911
i = rbml_w.writer.seek(SeekFrom::Current(0)).unwrap();
1936-
encode_misc_info(&ecx, krate, rbml_w);
19371912
encode_reachable(&ecx, rbml_w);
1938-
stats.misc_bytes = rbml_w.writer.seek(SeekFrom::Current(0)).unwrap() - i;
1913+
stats.reachable_bytes = rbml_w.writer.seek(SeekFrom::Current(0)).unwrap() - i;
19391914

19401915
// Encode and index the items.
19411916
rbml_w.start_tag(tag_items);
@@ -1972,7 +1947,7 @@ fn encode_metadata_inner(rbml_w: &mut Encoder,
19721947
println!(" codemap bytes: {}", stats.codemap_bytes);
19731948
println!(" macro def bytes: {}", stats.macro_defs_bytes);
19741949
println!(" impl bytes: {}", stats.impl_bytes);
1975-
println!(" misc bytes: {}", stats.misc_bytes);
1950+
println!(" reachable bytes: {}", stats.reachable_bytes);
19761951
println!(" item bytes: {}", stats.item_bytes);
19771952
println!(" index bytes: {}", stats.index_bytes);
19781953
println!(" xref bytes: {}", stats.xref_bytes);

0 commit comments

Comments
 (0)