Review changes
This commit is contained in:
parent
65616644af
commit
743d6a4132
1 changed files with 7 additions and 8 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue