add trait aliases to typeck
This commit is contained in:
parent
2eefc9db15
commit
63f1c24d8a
3 changed files with 11 additions and 2 deletions
|
@ -2577,6 +2577,7 @@ fn associated_item_def_ids<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
.map(|id| tcx.hir.local_def_id(id.node_id))
|
||||
.collect()
|
||||
}
|
||||
hir::ItemTraitAlias(..) => vec![],
|
||||
_ => span_bug!(item.span, "associated_item_def_ids: not impl or trait")
|
||||
};
|
||||
Rc::new(vec)
|
||||
|
|
|
@ -336,6 +336,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
|
|||
let path = &trait_ref.path;
|
||||
match path.def {
|
||||
Def::Trait(trait_def_id) => trait_def_id,
|
||||
Def::TraitAlias(alias_def_id) => alias_def_id,
|
||||
Def::Err => {
|
||||
self.tcx().sess.fatal("cannot continue compilation due to previous error");
|
||||
}
|
||||
|
|
|
@ -441,6 +441,11 @@ fn convert_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_id: ast::NodeId) {
|
|||
tcx.at(it.span).super_predicates_of(def_id);
|
||||
tcx.predicates_of(def_id);
|
||||
},
|
||||
hir::ItemTraitAlias(..) => {
|
||||
tcx.generics_of(def_id);
|
||||
tcx.trait_def(def_id);
|
||||
tcx.predicates_of(def_id);
|
||||
},
|
||||
hir::ItemStruct(ref struct_def, _) |
|
||||
hir::ItemUnion(ref struct_def, _) => {
|
||||
tcx.generics_of(def_id);
|
||||
|
@ -672,6 +677,7 @@ fn super_predicates_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
|
||||
let (generics, bounds) = match item.node {
|
||||
hir::ItemTrait(.., ref generics, ref supertraits, _) => (generics, supertraits),
|
||||
hir::ItemTraitAlias(ref generics, ref supertraits) => (generics, supertraits),
|
||||
_ => span_bug!(item.span,
|
||||
"super_predicates invoked on non-trait"),
|
||||
};
|
||||
|
@ -715,6 +721,7 @@ fn trait_def<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
|
||||
let unsafety = match item.node {
|
||||
hir::ItemTrait(_, unsafety, ..) => unsafety,
|
||||
hir::ItemTraitAlias(..) => hir::Unsafety::Normal,
|
||||
_ => span_bug!(item.span, "trait_def_of_item invoked on non-trait"),
|
||||
};
|
||||
|
||||
|
@ -902,7 +909,7 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
(generics, None)
|
||||
}
|
||||
|
||||
ItemTrait(_, _, ref generics, ..) => {
|
||||
ItemTrait(_, _, ref generics, ..) | ItemTraitAlias(ref generics, ..) => {
|
||||
// Add in the self type parameter.
|
||||
//
|
||||
// Something of a hack: use the node id for the trait, also as
|
||||
|
@ -1132,7 +1139,7 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
tcx.mk_adt(def, substs)
|
||||
}
|
||||
ItemAutoImpl(..) |
|
||||
ItemTrait(..) |
|
||||
ItemTrait(..) | ItemTraitAlias(..) |
|
||||
ItemMod(..) |
|
||||
ItemForeignMod(..) |
|
||||
ItemGlobalAsm(..) |
|
||||
|
|
Loading…
Reference in a new issue