Fix fallout from libsyntax implementation
This commit is contained in:
parent
6a2f16e136
commit
4148d5361a
9 changed files with 35 additions and 8 deletions
|
@ -126,6 +126,7 @@ enum Family {
|
|||
TupleVariant, // v
|
||||
StructVariant, // V
|
||||
Impl, // i
|
||||
DefTrait, // d
|
||||
Trait, // I
|
||||
Struct, // S
|
||||
PublicField, // g
|
||||
|
@ -151,6 +152,7 @@ fn item_family(item: rbml::Doc) -> Family {
|
|||
'v' => TupleVariant,
|
||||
'V' => StructVariant,
|
||||
'i' => Impl,
|
||||
'd' => DefTrait,
|
||||
'I' => Trait,
|
||||
'S' => Struct,
|
||||
'g' => PublicField,
|
||||
|
@ -357,7 +359,7 @@ fn item_to_def_like(item: rbml::Doc, did: ast::DefId, cnum: ast::CrateNum)
|
|||
}
|
||||
Trait => DlDef(def::DefTrait(did)),
|
||||
Enum => DlDef(def::DefTy(did, true)),
|
||||
Impl => DlImpl(did),
|
||||
Impl | DefTrait => DlImpl(did),
|
||||
PublicField | InheritedField => DlField,
|
||||
}
|
||||
}
|
||||
|
@ -480,7 +482,7 @@ pub fn get_impl_trait<'tcx>(cdata: Cmd,
|
|||
let item_doc = lookup_item(id, cdata.data());
|
||||
let fam = item_family(item_doc);
|
||||
match fam {
|
||||
Family::Impl => {
|
||||
Family::Impl | Family::DefTrait => {
|
||||
reader::maybe_get_doc(item_doc, tag_item_trait_ref).map(|tp| {
|
||||
doc_trait_ref(tp, tcx, cdata)
|
||||
})
|
||||
|
@ -1356,7 +1358,7 @@ pub fn get_trait_of_item(cdata: Cmd, id: ast::NodeId, tcx: &ty::ctxt)
|
|||
let parent_item_doc = lookup_item(parent_item_id.node, cdata.data());
|
||||
match item_family(parent_item_doc) {
|
||||
Trait => Some(item_def_id(parent_item_doc, cdata)),
|
||||
Impl => {
|
||||
Impl | DefTrait => {
|
||||
reader::maybe_get_doc(parent_item_doc, tag_item_trait_ref)
|
||||
.map(|_| item_trait_ref(parent_item_doc, tcx, cdata).def_id)
|
||||
}
|
||||
|
|
|
@ -1201,6 +1201,18 @@ fn encode_info_for_item(ecx: &EncodeContext,
|
|||
None => {}
|
||||
}
|
||||
}
|
||||
ast::ItemDefTrait(unsafety, ref ast_trait_ref) => {
|
||||
add_to_index(item, rbml_w, index);
|
||||
rbml_w.start_tag(tag_items_data_item);
|
||||
encode_def_id(rbml_w, def_id);
|
||||
encode_family(rbml_w, 'd');
|
||||
encode_name(rbml_w, item.ident.name);
|
||||
encode_unsafety(rbml_w, unsafety);
|
||||
|
||||
let trait_ref = ty::node_id_to_trait_ref(tcx, ast_trait_ref.ref_id);
|
||||
encode_trait_ref(rbml_w, ecx, &*trait_ref, tag_item_trait_ref);
|
||||
rbml_w.end_tag();
|
||||
}
|
||||
ast::ItemImpl(unsafety, polarity, _, ref opt_trait, ref ty, ref ast_items) => {
|
||||
// We need to encode information about the default methods we
|
||||
// have inherited, so we drive this based on the impl structure.
|
||||
|
|
|
@ -301,7 +301,8 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
|
|||
ast::ItemTy(..) | ast::ItemStatic(_, _, _) |
|
||||
ast::ItemMod(..) | ast::ItemForeignMod(..) |
|
||||
ast::ItemImpl(..) | ast::ItemTrait(..) |
|
||||
ast::ItemStruct(..) | ast::ItemEnum(..) => {}
|
||||
ast::ItemStruct(..) | ast::ItemEnum(..) |
|
||||
ast::ItemDefTrait(..) => {}
|
||||
|
||||
_ => {
|
||||
self.tcx.sess.span_bug(item.span,
|
||||
|
|
|
@ -115,6 +115,7 @@ impl<'a, 'v> Visitor<'v> for LifetimeContext<'a> {
|
|||
ast::ItemUse(_) |
|
||||
ast::ItemMod(..) |
|
||||
ast::ItemMac(..) |
|
||||
ast::ItemDefTrait(..) |
|
||||
ast::ItemForeignMod(..) |
|
||||
ast::ItemStatic(..) |
|
||||
ast::ItemConst(..) => {
|
||||
|
|
|
@ -209,7 +209,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EmbargoVisitor<'a, 'tcx> {
|
|||
match item.node {
|
||||
// impls/extern blocks do not break the "public chain" because they
|
||||
// cannot have visibility qualifiers on them anyway
|
||||
ast::ItemImpl(..) | ast::ItemForeignMod(..) => {}
|
||||
ast::ItemImpl(..) | ast::ItemDefTrait(..) | ast::ItemForeignMod(..) => {}
|
||||
|
||||
// Traits are a little special in that even if they themselves are
|
||||
// not public they may still be exported.
|
||||
|
@ -1145,6 +1145,7 @@ impl<'a, 'tcx> SanePrivacyVisitor<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
ast::ItemDefTrait(..) |
|
||||
ast::ItemConst(..) | ast::ItemStatic(..) | ast::ItemStruct(..) |
|
||||
ast::ItemFn(..) | ast::ItemMod(..) | ast::ItemTy(..) |
|
||||
ast::ItemExternCrate(_) | ast::ItemUse(_) | ast::ItemMac(..) => {}
|
||||
|
@ -1204,7 +1205,7 @@ impl<'a, 'tcx> SanePrivacyVisitor<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
ast::ItemExternCrate(_) | ast::ItemUse(_) |
|
||||
ast::ItemDefTrait(..) | ast::ItemExternCrate(_) | ast::ItemUse(_) |
|
||||
ast::ItemStatic(..) | ast::ItemConst(..) |
|
||||
ast::ItemFn(..) | ast::ItemMod(..) | ast::ItemTy(..) |
|
||||
ast::ItemMac(..) => {}
|
||||
|
|
|
@ -40,7 +40,7 @@ use syntax::ast::{Block, Crate};
|
|||
use syntax::ast::{DeclItem, DefId};
|
||||
use syntax::ast::{ForeignItem, ForeignItemFn, ForeignItemStatic};
|
||||
use syntax::ast::{Item, ItemConst, ItemEnum, ItemExternCrate, ItemFn};
|
||||
use syntax::ast::{ItemForeignMod, ItemImpl, ItemMac, ItemMod, ItemStatic};
|
||||
use syntax::ast::{ItemForeignMod, ItemImpl, ItemMac, ItemMod, ItemStatic, ItemDefTrait};
|
||||
use syntax::ast::{ItemStruct, ItemTrait, ItemTy, ItemUse};
|
||||
use syntax::ast::{MethodImplItem, Name, NamedField, NodeId};
|
||||
use syntax::ast::{PathListIdent, PathListMod};
|
||||
|
@ -656,6 +656,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
|
|||
parent.clone()
|
||||
}
|
||||
|
||||
ItemDefTrait(_, _) |
|
||||
ItemImpl(_, _, _, Some(_), _, _) => parent.clone(),
|
||||
|
||||
ItemTrait(_, _, _, ref items) => {
|
||||
|
|
|
@ -70,7 +70,7 @@ use syntax::ast::{ExprClosure, ExprLoop, ExprWhile, ExprMethodCall};
|
|||
use syntax::ast::{ExprPath, ExprQPath, ExprStruct, FnDecl};
|
||||
use syntax::ast::{ForeignItemFn, ForeignItemStatic, Generics};
|
||||
use syntax::ast::{Ident, ImplItem, Item, ItemConst, ItemEnum, ItemExternCrate};
|
||||
use syntax::ast::{ItemFn, ItemForeignMod, ItemImpl, ItemMac, ItemMod, ItemStatic};
|
||||
use syntax::ast::{ItemFn, ItemForeignMod, ItemImpl, ItemMac, ItemMod, ItemStatic, ItemDefTrait};
|
||||
use syntax::ast::{ItemStruct, ItemTrait, ItemTy, ItemUse};
|
||||
use syntax::ast::{Local, MethodImplItem, Mod, Name, NodeId};
|
||||
use syntax::ast::{Pat, PatEnum, PatIdent, PatLit};
|
||||
|
@ -2840,6 +2840,9 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
|||
});
|
||||
}
|
||||
|
||||
ItemDefTrait(_, ref trait_ref) => {
|
||||
self.resolve_trait_reference(item.id, trait_ref, TraitImplementation);
|
||||
}
|
||||
ItemImpl(_, _,
|
||||
ref generics,
|
||||
ref implemented_traits,
|
||||
|
|
|
@ -648,6 +648,9 @@ fn convert_item(ccx: &CollectCtxt, it: &ast::Item) {
|
|||
predicates,
|
||||
&enum_definition.variants);
|
||||
},
|
||||
ast::ItemDefTrait(_, ref ast_trait_ref) => {
|
||||
|
||||
}
|
||||
ast::ItemImpl(_, _,
|
||||
ref generics,
|
||||
ref opt_trait_ref,
|
||||
|
@ -1141,6 +1144,7 @@ fn compute_type_scheme_of_item<'a,'tcx>(ccx: &CollectCtxt<'a,'tcx>,
|
|||
let t = ty::mk_struct(tcx, local_def(it.id), tcx.mk_substs(substs));
|
||||
ty::TypeScheme { ty: t, generics: ty_generics }
|
||||
}
|
||||
ast::ItemDefTrait(..) |
|
||||
ast::ItemTrait(..) |
|
||||
ast::ItemImpl(..) |
|
||||
ast::ItemMod(..) |
|
||||
|
|
|
@ -476,6 +476,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for TermsContext<'a, 'tcx> {
|
|||
|
||||
ast::ItemExternCrate(_) |
|
||||
ast::ItemUse(_) |
|
||||
ast::ItemDefTrait(..) |
|
||||
ast::ItemImpl(..) |
|
||||
ast::ItemStatic(..) |
|
||||
ast::ItemConst(..) |
|
||||
|
@ -626,6 +627,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for ConstraintContext<'a, 'tcx> {
|
|||
ast::ItemForeignMod(..) |
|
||||
ast::ItemTy(..) |
|
||||
ast::ItemImpl(..) |
|
||||
ast::ItemDefTrait(..) |
|
||||
ast::ItemMac(..) => {
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue