rust-lang / book

The Rust Programming Language
https://doc.rust-lang.org/book/
Other
15k stars 3.39k forks source link

Ch17-03 Mentions Object Safety with Little Explanation #3949

Open LukeFranceschini opened 4 months ago

LukeFranceschini commented 4 months ago

URL to the section(s) of the book with this problem: https://doc.rust-lang.org/book/ch17-03-oo-design-patterns.html

Description of the problem: The book references object safety in chapter 17.3 without mentioning it anywhere else in the entire book. The duplicate logic section explains that the duplication is necessary to maintain object safety as if the user should be aware of the meaning of object safety. However, the object safety section was removed in 727ef100 after discussion in #2787 and #2790. This removed section would have given some background context for the duplicate logic paragraph in chapter 17.3. Without that section, this paragraph about duplicate implementation is quite confusing, requiring the reader (or at least me) to Google what object safety means to understand the issue.

Suggested fix: I'm not sure what would make the most sense here:

The next paragraph talks about duplicate implementation anyway, so there would still be discussion about that issue if the object safety paragraph was removed. I know there were several other pull requests and issues discussing the object safety section, and it was slowly reduced in size until it was removed entirely. Maybe this would just be the final nail in the object safety coffin.

In any case, I thought I'd bring it up after the confusion it caused me when reading this section. I'd be happy to help with any changes that need to be made, but I figured I'd check to see what we think the best course of action is first. Thanks!

chriskrycho commented 3 months ago

Ah, interesting bit of evolution of the text there—thanks for opening this! We will think on the best way to proceed.