Address nits.

This commit is contained in:
Niko Matsakis 2015-01-02 05:34:49 -05:00
parent a535f2aab1
commit 704ed4c7d0
2 changed files with 8 additions and 14 deletions

View File

@ -38,17 +38,16 @@ pub enum ObjectSafetyViolation<'tcx> {
/// Reasons a method might not be object-safe.
#[deriving(Copy,Clone,Show)]
pub enum MethodViolationCode {
/// fn(self),
/// e.g., `fn(self)`
ByValueSelf,
// fn foo()
/// e.g., `fn foo()`
StaticMethod,
// fn foo(&self, x: Self)
// fn foo(&self) -> Self
/// e.g., `fn foo(&self, x: Self)` or `fn foo(&self) -> Self`
ReferencesSelf,
// fn foo<A>(),
/// e.g., `fn foo<A>()`
Generic,
}

View File

@ -1045,15 +1045,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
upcast_trait_ref.repr(self.tcx()));
// check whether the upcast version of the trait-ref matches what we are looking for
match
self.infcx.probe(
|_| self.match_poly_trait_ref(obligation, upcast_trait_ref.clone()))
{
Ok(()) => {
debug!("assemble_candidates_from_object_ty: matched, pushing candidate");
candidates.vec.push(ObjectCandidate);
}
Err(()) => { }
if let Ok(()) = self.infcx.probe(|_| self.match_poly_trait_ref(obligation,
upcast_trait_ref.clone())) {
debug!("assemble_candidates_from_object_ty: matched, pushing candidate");
candidates.vec.push(ObjectCandidate);
}
}