Skip to content

Renaming "object safe" to "dyn compatible" #291

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Kajiih opened this issue May 6, 2025 · 0 comments
Open

Renaming "object safe" to "dyn compatible" #291

Kajiih opened this issue May 6, 2025 · 0 comments

Comments

@Kajiih
Copy link

Kajiih commented May 6, 2025

  • I have searched open and closed issues and pull requests for duplicates, using these search terms:
    • ch18-3
    • object safe
    • dyn trait
  • I have checked the latest main branch to see if this has already been fixed, in this file:
    • src/ch18-03-oo-design-patterns.md?plain=1#L360

URL to the section(s) of the book with this problem: https://rust-book.cs.brown.edu/ch18-03-oo-design-patterns.html

Description of the problem:

I noticed that the term "object safety" has been renamed to "dyn compatible" as per rust-lang/lang-team#286, but the book is not updated and still use the (confusing?) terms "object safe" and "object safety".

[...] however, this would violate object safety, because the trait doesn’t know what the concrete self will be exactly. We want to be able to use State as a trait object, so we need its methods to be object safe.

Tracking issue for this change: rust-lang/rust#130852

Suggested fix:

[...] however, this would violate dyn compatibility, because the trait doesn’t know what the concrete self will be exactly. We want to be able to use State as a trait object, so we need its methods to be compatible with trait objects-this is known as dyn compatible.

We might also add a reference to the former term, for example:

[...]-this is known as dyn compatible. In older documentation, this concept is often referred to as object safety.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant