Description
- 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.