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. /// Reasons a method might not be object-safe.
#[deriving(Copy,Clone,Show)] #[deriving(Copy,Clone,Show)]
pub enum MethodViolationCode { pub enum MethodViolationCode {
/// fn(self), /// e.g., `fn(self)`
ByValueSelf, ByValueSelf,
// fn foo() /// e.g., `fn foo()`
StaticMethod, StaticMethod,
// fn foo(&self, x: Self) /// e.g., `fn foo(&self, x: Self)` or `fn foo(&self) -> Self`
// fn foo(&self) -> Self
ReferencesSelf, ReferencesSelf,
// fn foo<A>(), /// e.g., `fn foo<A>()`
Generic, Generic,
} }

View file

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