don't store method_fty
It is redundant with the item type. This is not much of a win, as there are really not *that* many methods, but it makes the code uglier.
This commit is contained in:
parent
a1c921e8a5
commit
8557cb47cb
@ -163,8 +163,7 @@ pub enum astencode_tag { // Reserves 0x50 -- 0x6f
|
||||
pub const tag_item_unnamed_field: usize = 0x77;
|
||||
pub const tag_items_data_item_visibility: usize = 0x78;
|
||||
|
||||
// GAP 0x79
|
||||
pub const tag_item_method_fty: usize = 0x7a;
|
||||
// GAP 0x79, 0x7a
|
||||
|
||||
pub const tag_mod_child: usize = 0x7b;
|
||||
pub const tag_misc_info: usize = 0x108; // top-level only
|
||||
|
@ -219,14 +219,6 @@ fn maybe_doc_type<'tcx>(doc: rbml::Doc, tcx: &ty::ctxt<'tcx>, cdata: Cmd) -> Opt
|
||||
})
|
||||
}
|
||||
|
||||
fn doc_method_fty<'tcx>(doc: rbml::Doc, tcx: &ty::ctxt<'tcx>,
|
||||
cdata: Cmd) -> ty::BareFnTy<'tcx> {
|
||||
let tp = reader::get_doc(doc, tag_item_method_fty);
|
||||
TyDecoder::with_doc(tcx, cdata.cnum, tp,
|
||||
&mut |_, did| translate_def_id(cdata, did))
|
||||
.parse_bare_fn_ty()
|
||||
}
|
||||
|
||||
pub fn item_type<'tcx>(_item_id: DefId, item: rbml::Doc,
|
||||
tcx: &ty::ctxt<'tcx>, cdata: Cmd) -> Ty<'tcx> {
|
||||
doc_type(item, tcx, cdata)
|
||||
@ -880,7 +872,13 @@ pub fn get_impl_or_trait_item<'tcx>(intr: Rc<IdentInterner>,
|
||||
Some('r') | Some('p') => {
|
||||
let generics = doc_generics(item_doc, tcx, cdata, tag_method_ty_generics);
|
||||
let predicates = doc_predicates(item_doc, tcx, cdata, tag_method_ty_generics);
|
||||
let fty = doc_method_fty(item_doc, tcx, cdata);
|
||||
let ity = tcx.lookup_item_type(def_id).ty;
|
||||
let fty = match ity.sty {
|
||||
ty::TyBareFn(_, fty) => fty.clone(),
|
||||
_ => tcx.sess.bug(&format!(
|
||||
"the type {:?} of the method {:?} is not a function?",
|
||||
ity, name))
|
||||
};
|
||||
let explicit_self = get_explicit_self(item_doc);
|
||||
|
||||
ty::MethodTraitItem(Rc::new(ty::Method::new(name,
|
||||
|
@ -235,22 +235,6 @@ fn encode_region(ecx: &EncodeContext,
|
||||
rbml_w.end_tag();
|
||||
}
|
||||
|
||||
fn encode_method_fty<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
|
||||
rbml_w: &mut Encoder,
|
||||
typ: &ty::BareFnTy<'tcx>) {
|
||||
rbml_w.start_tag(tag_item_method_fty);
|
||||
|
||||
let ty_str_ctxt = &tyencode::ctxt {
|
||||
diag: ecx.diag,
|
||||
ds: def_to_string,
|
||||
tcx: ecx.tcx,
|
||||
abbrevs: &ecx.type_abbrevs
|
||||
};
|
||||
tyencode::enc_bare_fn_ty(rbml_w, ty_str_ctxt, typ);
|
||||
|
||||
rbml_w.end_tag();
|
||||
}
|
||||
|
||||
fn encode_symbol(ecx: &EncodeContext,
|
||||
rbml_w: &mut Encoder,
|
||||
id: NodeId) {
|
||||
@ -755,7 +739,6 @@ fn encode_method_ty_fields<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
|
||||
encode_generics(rbml_w, ecx, index,
|
||||
&method_ty.generics, &method_ty.predicates,
|
||||
tag_method_ty_generics);
|
||||
encode_method_fty(ecx, rbml_w, &method_ty.fty);
|
||||
encode_visibility(rbml_w, method_ty.vis);
|
||||
encode_explicit_self(rbml_w, &method_ty.explicit_self);
|
||||
match method_ty.explicit_self {
|
||||
@ -826,7 +809,6 @@ fn encode_info_for_method<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
|
||||
let stab = stability::lookup(ecx.tcx, m.def_id);
|
||||
encode_stability(rbml_w, stab);
|
||||
|
||||
// The type for methods gets encoded twice, which is unfortunate.
|
||||
encode_bounds_and_type_for_item(rbml_w, ecx, index, m.def_id.local_id());
|
||||
|
||||
let elem = ast_map::PathName(m.name);
|
||||
|
Loading…
Reference in New Issue
Block a user