Skip to content

Commit

Permalink
Always consider static methods object-safe
Browse files Browse the repository at this point in the history
This also fixes #18490 as a side-effect by avoiding a later
out-of-bounds slice.
  • Loading branch information
bkoropoff committed Nov 2, 2014
1 parent 3327ecc commit cf77564
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/librustc/middle/typeck/check/vtable.rs
Expand Up @@ -187,7 +187,11 @@ pub fn check_object_safety(tcx: &ty::ctxt, object_trait: &ty::TyTrait, span: Spa
receiver through a trait object", method_name))
}

ty::StaticExplicitSelfCategory |
ty::StaticExplicitSelfCategory => {
// Static methods are always object-safe since they
// can't be called through a trait object
return msgs
}
ty::ByReferenceExplicitSelfCategory(..) |
ty::ByBoxExplicitSelfCategory => {}
}
Expand Down

0 comments on commit cf77564

Please sign in to comment.