Skip to content

Commit

Permalink
Change method lookup infrastructure to use the trait methods. Instead
Browse files Browse the repository at this point in the history
of tracking individual candidates per impl, we just track one
candidate for the extension trait itself, and let the trait resolution
handle walking the individual impls and so forth. Also change the
interface to report back a richer notion of error.
  • Loading branch information
nikomatsakis committed Oct 21, 2014
1 parent 1562d8c commit dad2db7
Show file tree
Hide file tree
Showing 4 changed files with 640 additions and 661 deletions.
11 changes: 11 additions & 0 deletions src/librustc/middle/ty.rs
Expand Up @@ -120,6 +120,13 @@ impl ImplOrTraitItem {
TypeTraitItem(ref associated_type) => associated_type.container,
}
}

pub fn as_opt_method(&self) -> Option<Rc<Method>> {
match *self {
MethodTraitItem(ref m) => Some((*m).clone()),
TypeTraitItem(_) => None
}
}
}

#[deriving(Clone)]
Expand Down Expand Up @@ -1240,6 +1247,10 @@ impl Generics {
}

impl TraitRef {
pub fn new(def_id: ast::DefId, substs: Substs) -> TraitRef {
TraitRef { def_id: def_id, substs: substs }
}

pub fn self_ty(&self) -> ty::t {
self.substs.self_ty().unwrap()
}
Expand Down

0 comments on commit dad2db7

Please sign in to comment.