What Rust security guarantees will be lost, if not for object security?

I am trying to understand the idea of ​​securing an object. I know from the documentation that the security of objects is as follows:

  • This property does not require Self: Sized
  • All its methods are object-safe.

What are some of the things that could possibly lead to a waiver of the security guarantees that a secure Rust can provide, can be canceled if none of the two conditions necessary for the security of an object have fallen?

+1
source share
1 answer

From Where to self-service: Object safety review :

Tracking an object is safe only if the compiler can automatically implement it for itself, implementing each method as a call to a dynamic function through a virtual table stored in the attribute object.

Without object security rules, you can write functions with type signatures that are satisfied by feature objects, where the internals make it impossible to actually use with feature objects.

I believe that the choice of the phrase “object security” may be unsuccessful in retrospect, because it seems to have nothing to do with memory security, the usual use of the term “(un)“ safe ”in Rust.

Objective "ability" may be closer to the truth; feature that can be transmitted through the feature object.

+7
source

Source: https://habr.com/ru/post/1265076/


All Articles