diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_typeck/astconv.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 02fdd59a1c9..87eda76db29 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -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 { |
