[−][src]Module rustc_trait_selection::traits::object_safety
"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
Selfexcept for in this receiver; - not have generic type parameters.
Enums
| MethodViolationCode | Reasons a method might not be object-safe. |
| ObjectSafetyViolation |
Functions
| astconv_object_safety_violations | Returns the object safety violations that affect
astconv -- currently, |
| bounds_reference_self | |
| contains_illegal_self_type_reference | |
| generics_require_sized_self | |
| get_sized_bounds | |
| is_vtable_safe_method | 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 |
| lint_object_unsafe_trait | Lint object-unsafe trait. |
| object_safety_violation_for_method | Returns |
| object_safety_violations | |
| object_safety_violations_for_trait | |
| object_ty_for_trait | Creates the object type for the current trait. For example,
if the current trait is |
| predicate_references_self | |
| predicates_reference_self | |
| provide | |
| receiver_for_self_ty | Performs a type substitution to produce the version of |
| receiver_is_dispatchable | Checks the method's receiver (the |
| sized_trait_bound_spans | |
| trait_has_sized_self | |
| virtual_call_violation_for_method | Returns |