-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Description
- I have searched open and closed issues and pull requests for duplicates, using these search terms:
- "unsafe fn"
- I have checked the latest
mainbranch to see if this has already been fixed, in this file:src/ch20-01-unsafe-rust.md
URL to the section(s) of the book with this problem:
book/src/ch20-01-unsafe-rust.md
Lines 189 to 191 in 6cc1bb8
| Bodies of unsafe functions are effectively `unsafe` blocks, so to perform other | |
| unsafe operations within an unsafe function, we don’t need to add another | |
| `unsafe` block. |
Description of the problem: Since RFC 2585, use of unsafe language features in unsafe fns outside of unsafe blocks is being gradually deprecated. They are currently a lint that will become a warning in the 2024 edition and may become an error in the future.
Suggested fix: Remove this paragraph altogether? Or clarify, such as: "Bodies of unsafe functions used to be trated as unsafe blocks by the compiler, but this feature is being gradually removed in newer editions of Rust. Just as in a regular function, we can use unsafe blocks inside an unsafe function to gain access to unsafe superpowers." The latter would help avoid surprises when working with older code, and there might be some value in showing that the language is changing.