Module rustc_trait_selection::traits::object_safety

source ·
Expand description

“Object safety” refers to the ability for a trait to be converted to an object. In general, traits may only be converted to an object if all of their methods meet certain criteria. In particular, they must:

  • have a suitable receiver from which we can extract a vtable and coerce to a “thin” version that doesn’t contain the vtable;
  • not reference the erased type Self except for in this receiver;
  • not have generic type parameters.