提交 743d6a41 编写于 作者: N Nick Cameron

Review changes

上级 65616644
......@@ -73,6 +73,11 @@ pub trait AstConv<'tcx> {
fn tcx<'a>(&'a self) -> &'a ty::ctxt<'tcx>;
fn get_item_ty(&self, id: ast::DefId) -> ty::Polytype<'tcx>;
fn get_trait_def(&self, id: ast::DefId) -> Rc<ty::TraitDef<'tcx>>;
/// Return an (optional) substitution to convert bound type parameters that
/// are in scope into free ones. This function should only return Some
/// within a fn body.
/// See ParameterEnvironment::free_substs for more information.
fn get_free_substs(&self) -> Option<&Substs<'tcx>> {
None
}
......@@ -1029,7 +1034,8 @@ pub fn ast_ty_to_ty<'tcx, AC: AstConv<'tcx>, RS: RegionScope>(
// FIXME(#19541): in both branches we should consider
// associated types in super-traits.
let (assoc_tys, tp_name): (Vec<_>, _) = match typ {
def::TyParamProvenance::FromParam(did) => {
def::TyParamProvenance::FromParam(did) |
def::TyParamProvenance::FromSelf(did) => {
let ty_param_defs = tcx.ty_param_defs.borrow();
let tp_def = &(*ty_param_defs)[did.node];
let assoc_tys = tp_def.bounds.trait_bounds.iter()
......@@ -1037,13 +1043,6 @@ pub fn ast_ty_to_ty<'tcx, AC: AstConv<'tcx>, RS: RegionScope>(
.collect();
(assoc_tys, token::get_name(tp_def.name).to_string())
}
def::TyParamProvenance::FromSelf(did) => {
let assoc_tys = find_assoc_ty(this,
&*this.get_trait_def(did).trait_ref,
assoc_ident)
.into_iter().collect();
(assoc_tys, "Self".to_string())
}
};
if assoc_tys.len() == 0 {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册