- /// We say a method is *vtable safe* if it can be invoked on a trait
- /// object. Note that object-safe traits can have some
- /// non-vtable-safe methods, so long as they require `Self: Sized` or
- /// otherwise ensure that they cannot be used when `Self = Trait`.
- pub fn is_vtable_safe_method(self, trait_def_id: DefId, method: &ty::AssocItem) -> bool {
- debug_assert!(self.generics_of(trait_def_id).has_self);
- debug!("is_vtable_safe_method({:?}, {:?})", trait_def_id, method);
- // Any method that has a `Self: Sized` bound cannot be called.
- if generics_require_sized_self(self, method.def_id) {
- return false;
- }
-
- match virtual_call_violation_for_method(self, trait_def_id, method) {
- None | Some(MethodViolationCode::WhereClauseReferencesSelf) => true,
- Some(_) => false,
- }
+ match virtual_call_violation_for_method(tcx, trait_def_id, method) {
+ None | Some(MethodViolationCode::WhereClauseReferencesSelf) => true,
+ Some(_) => false,