Skip to content

Commit

Permalink
Review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nrc committed Dec 16, 2014
1 parent 6561664 commit 743d6a4
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/librustc_typeck/astconv.rs
Expand Up @@ -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
}
Expand Down Expand Up @@ -1029,21 +1034,15 @@ 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()
.filter_map(|b| find_assoc_ty(this, &**b, assoc_ident))
.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 {
Expand Down

7 comments on commit 743d6a4

@bors
Copy link
Contributor

@bors bors commented on 743d6a4 Dec 17, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from nikomatsakis
at nrc@743d6a4

@bors
Copy link
Contributor

@bors bors commented on 743d6a4 Dec 17, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging nick29581/rust/assoc-ufcs2 = 743d6a4 into auto

@bors
Copy link
Contributor

@bors bors commented on 743d6a4 Dec 17, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

status: {"merge_sha": "4e8ba4955c6a6510102973b2d7bdd8ae3d682c15"}

@bors
Copy link
Contributor

@bors bors commented on 743d6a4 Dec 17, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nick29581/rust/assoc-ufcs2 = 743d6a4 merged ok, testing candidate = 4e8ba49

@bors
Copy link
Contributor

@bors bors commented on 743d6a4 Dec 17, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 4e8ba49

@bors
Copy link
Contributor

@bors bors commented on 743d6a4 Dec 17, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 4e8ba49

Please sign in to comment.