Skip to content

Commit 67e60bf

Browse files
Ariel Ben-Yehudaarielb1
authored andcommitted
remove unneeded tags from metadata
stage1 release rlib sizes: 580890 liballoc-bb943c5a.rlib 1425558 liballoc_jemalloc-bb943c5a.rlib 10514 liballoc_system-bb943c5a.rlib 157192 libarena-bb943c5a.rlib 4316234 libcollections-bb943c5a.rlib 19580128 libcore-bb943c5a.rlib 199498 libflate-bb943c5a.rlib 249328 libfmt_macros-bb943c5a.rlib 560406 libgetopts-bb943c5a.rlib 233620 libgraphviz-bb943c5a.rlib 442964 liblibc-bb943c5a.rlib 190178 liblog-bb943c5a.rlib 778488 librand-bb943c5a.rlib 621972 librbml-bb943c5a.rlib 1415040 librustc_back-bb943c5a.rlib 38849082 librustc-bb943c5a.rlib 12862 librustc_bitflags-bb943c5a.rlib 2331690 librustc_borrowck-bb943c5a.rlib 616880 librustc_data_structures-bb943c5a.rlib 9386582 librustc_driver-bb943c5a.rlib 9600440 librustc_front-bb943c5a.rlib 1615058 librustc_lint-bb943c5a.rlib 79218480 librustc_llvm-bb943c5a.rlib 5020974 librustc_mir-bb943c5a.rlib 3535448 librustc_platform_intrinsics-bb943c5a.rlib 603640 librustc_privacy-bb943c5a.rlib 3163628 librustc_resolve-bb943c5a.rlib 14326646 librustc_trans-bb943c5a.rlib 12033174 librustc_typeck-bb943c5a.rlib 1838202 librustc_unicode-bb943c5a.rlib 15611582 librustdoc-bb943c5a.rlib 3056280 libserialize-bb943c5a.rlib 8954312 libstd-bb943c5a.rlib 30906736 libsyntax-bb943c5a.rlib 925480 libterm-bb943c5a.rlib 1377952 libtest-bb943c5a.rlib
1 parent 8719f50 commit 67e60bf

File tree

4 files changed

+11
-69
lines changed

4 files changed

+11
-69
lines changed

src/librustc/metadata/common.rs

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ pub const tag_crate_dep_crate_name: usize = 0x36;
7474
pub const tag_crate_dep_hash: usize = 0x37;
7575
pub const tag_crate_dep_explicitly_linked: usize = 0x38; // top-level only
7676

77-
pub const tag_mod_impl: usize = 0x39;
78-
7977
pub const tag_item_trait_item: usize = 0x3a;
8078

8179
pub const tag_item_trait_ref: usize = 0x3b;
@@ -89,7 +87,6 @@ pub const tag_path_len: usize = 0x3e;
8987
pub const tag_path_elem_mod: usize = 0x3f;
9088
pub const tag_path_elem_name: usize = 0x40;
9189
pub const tag_item_field: usize = 0x41;
92-
pub const tag_item_field_origin: usize = 0x42;
9390

9491
pub const tag_item_variances: usize = 0x43;
9592
/*
@@ -119,8 +116,7 @@ enum_from_u32! {
119116

120117
tag_tree = 0x51,
121118

122-
tag_id_range = 0x52,
123-
119+
// GAP 0x52
124120
tag_table = 0x53,
125121
// GAP 0x54, 0x55
126122
tag_table_def = 0x56,
@@ -129,30 +125,22 @@ enum_from_u32! {
129125
tag_table_freevars = 0x59,
130126
tag_table_tcache = 0x5a,
131127
tag_table_param_defs = 0x5b,
132-
tag_table_mutbl = 0x5c,
133-
tag_table_last_use = 0x5d,
134-
tag_table_spill = 0x5e,
128+
// GAP 0x5c, 0x5d, 0x5e
135129
tag_table_method_map = 0x5f,
136-
tag_table_vtable_map = 0x60,
130+
// GAP 0x60
137131
tag_table_adjustments = 0x61,
138-
tag_table_moves_map = 0x62,
139-
tag_table_capture_map = 0x63,
132+
// GAP 0x62, 0x63
140133
tag_table_closure_tys = 0x64,
141134
tag_table_closure_kinds = 0x65,
142135
tag_table_upvar_capture_map = 0x66,
143-
tag_table_capture_modes = 0x67,
144-
// GAP 0x68
136+
// GAP 0x67, 0x68
145137
tag_table_const_qualif = 0x69,
146138
tag_table_cast_kinds = 0x6a,
147139
}
148140
}
149141

150142
pub const tag_item_trait_item_sort: usize = 0x70;
151143

152-
pub const tag_item_trait_parent_sort: usize = 0x71;
153-
154-
pub const tag_item_impl_type_basename: usize = 0x72;
155-
156144
pub const tag_crate_triple: usize = 0x105; // top-level only
157145

158146
pub const tag_dylib_dependency_formats: usize = 0x106; // top-level only
@@ -173,15 +161,15 @@ pub const tag_lang_items_missing: usize = 0x76;
173161
pub const tag_item_unnamed_field: usize = 0x77;
174162
pub const tag_items_data_item_visibility: usize = 0x78;
175163

176-
pub const tag_item_method_tps: usize = 0x79;
164+
// GAP 0x79
177165
pub const tag_item_method_fty: usize = 0x7a;
178166

179167
pub const tag_mod_child: usize = 0x7b;
180168
pub const tag_misc_info: usize = 0x108; // top-level only
181169
pub const tag_misc_info_crate_items: usize = 0x7c;
182170

183171
// GAP 0x7d
184-
pub const tag_item_impl_vtables: usize = 0x7e;
172+
// GAP 0x7e
185173

186174
pub const tag_impls: usize = 0x109; // top-level only
187175
pub const tag_impls_impl: usize = 0x7f;

src/librustc/metadata/csearch.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,6 @@ pub fn get_associated_consts<'tcx>(tcx: &ty::ctxt<'tcx>, def: DefId)
171171
decoder::get_associated_consts(cstore.intr.clone(), &*cdata, def.node, tcx)
172172
}
173173

174-
pub fn get_type_name_if_impl(cstore: &cstore::CStore, def: DefId)
175-
-> Option<ast::Name> {
176-
let cdata = cstore.get_crate_data(def.krate);
177-
decoder::get_type_name_if_impl(&*cdata, def.node)
178-
}
179-
180174
pub fn get_methods_if_impl(cstore: &cstore::CStore,
181175
def: DefId)
182176
-> Option<Vec<MethodInfo> > {

src/librustc/metadata/decoder.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -979,18 +979,6 @@ pub fn get_associated_consts<'tcx>(intr: Rc<IdentInterner>,
979979
}).collect()
980980
}
981981

982-
pub fn get_type_name_if_impl(cdata: Cmd,
983-
node_id: ast::NodeId) -> Option<ast::Name> {
984-
let item = cdata.lookup_item(node_id);
985-
if item_family(item) != Impl {
986-
return None;
987-
}
988-
989-
reader::tagged_docs(item, tag_item_impl_type_basename).nth(0).map(|doc| {
990-
token::intern(doc.as_str_slice())
991-
})
992-
}
993-
994982
pub fn get_methods_if_impl(intr: Rc<IdentInterner>,
995983
cdata: Cmd,
996984
node_id: ast::NodeId)

src/librustc/metadata/encoder.rs

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,6 @@ fn encode_name(rbml_w: &mut Encoder, name: Name) {
7878
rbml_w.wr_tagged_str(tag_paths_data_name, &name.as_str());
7979
}
8080

81-
fn encode_impl_type_basename(rbml_w: &mut Encoder, name: Name) {
82-
rbml_w.wr_tagged_str(tag_item_impl_type_basename, &name.as_str());
83-
}
84-
8581
fn encode_def_id(rbml_w: &mut Encoder, id: DefId) {
8682
rbml_w.wr_tagged_u64(tag_def_id, def_to_u64(id));
8783
}
@@ -253,8 +249,7 @@ fn encode_parent_item(rbml_w: &mut Encoder, id: DefId) {
253249
}
254250

255251
fn encode_struct_fields(rbml_w: &mut Encoder,
256-
variant: ty::VariantDef,
257-
origin: DefId) {
252+
variant: ty::VariantDef) {
258253
for f in &variant.fields {
259254
if f.name == special_idents::unnamed_field.name {
260255
rbml_w.start_tag(tag_item_unnamed_field);
@@ -264,7 +259,6 @@ fn encode_struct_fields(rbml_w: &mut Encoder,
264259
}
265260
encode_struct_field_family(rbml_w, f.vis);
266261
encode_def_id(rbml_w, f.did);
267-
rbml_w.wr_tagged_u64(tag_item_field_origin, def_to_u64(origin));
268262
rbml_w.end_tag();
269263
}
270264
}
@@ -311,7 +305,7 @@ fn encode_enum_variant_info(ecx: &EncodeContext,
311305
let stab = stability::lookup(ecx.tcx, vid);
312306
encode_stability(rbml_w, stab);
313307

314-
encode_struct_fields(rbml_w, variant, vid);
308+
encode_struct_fields(rbml_w, variant);
315309

316310
let specified_disr_val = variant.disr_val;
317311
if specified_disr_val != disr_val {
@@ -518,15 +512,6 @@ fn encode_info_for_mod(ecx: &EncodeContext,
518512
def_to_u64(DefId::local(auxiliary_node_id)));
519513
true
520514
});
521-
522-
if let hir::ItemImpl(..) = item.node {
523-
let (name, did) = (item.name, item.id);
524-
debug!("(encoding info for module) ... encoding impl {} ({}/{})",
525-
name,
526-
did, ecx.tcx.map.node_to_string(did));
527-
528-
rbml_w.wr_tagged_u64(tag_mod_impl, def_to_u64(DefId::local(did)));
529-
}
530515
}
531516

532517
encode_path(rbml_w, path.clone());
@@ -605,10 +590,6 @@ fn encode_item_sort(rbml_w: &mut Encoder, sort: char) {
605590
rbml_w.wr_tagged_u8(tag_item_trait_item_sort, sort as u8);
606591
}
607592

608-
fn encode_parent_sort(rbml_w: &mut Encoder, sort: char) {
609-
rbml_w.wr_tagged_u8(tag_item_trait_parent_sort, sort as u8);
610-
}
611-
612593
fn encode_field<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
613594
rbml_w: &mut Encoder,
614595
field: ty::FieldDef<'tcx>,
@@ -1147,7 +1128,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
11471128
/* Encode def_ids for each field and method
11481129
for methods, write all the stuff get_trait_method
11491130
needs to know*/
1150-
encode_struct_fields(rbml_w, variant, def_id);
1131+
encode_struct_fields(rbml_w, variant);
11511132

11521133
encode_inlined_item(ecx, rbml_w, InlinedItemRef::Item(item));
11531134

@@ -1177,7 +1158,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
11771158
encode_trait_ref(rbml_w, ecx, trait_ref, tag_item_trait_ref);
11781159
rbml_w.end_tag();
11791160
}
1180-
hir::ItemImpl(unsafety, polarity, _, _, ref ty, ref ast_items) => {
1161+
hir::ItemImpl(unsafety, polarity, _, _, _, ref ast_items) => {
11811162
// We need to encode information about the default methods we
11821163
// have inherited, so we drive this based on the impl structure.
11831164
let impl_items = tcx.impl_items.borrow();
@@ -1202,13 +1183,6 @@ fn encode_info_for_item(ecx: &EncodeContext,
12021183
None => {}
12031184
}
12041185

1205-
match ty.node {
1206-
hir::TyPath(None, ref path) if path.segments.len() == 1 => {
1207-
let name = path.segments.last().unwrap().identifier.name;
1208-
encode_impl_type_basename(rbml_w, name);
1209-
}
1210-
_ => {}
1211-
}
12121186
for &item_def_id in items {
12131187
rbml_w.start_tag(tag_item_impl_item);
12141188
match item_def_id {
@@ -1412,8 +1386,6 @@ fn encode_info_for_item(ecx: &EncodeContext,
14121386
}
14131387
}
14141388

1415-
encode_parent_sort(rbml_w, 't');
1416-
14171389
let trait_item = &*ms[i];
14181390
encode_attributes(rbml_w, &trait_item.attrs);
14191391
match trait_item.node {

0 commit comments

Comments
 (0)