cognitive-engineering-lab / rust-book

The Rust Programming Language: Experimental Edition
https://rust-book.cs.brown.edu
Other
509 stars 83 forks source link

Quiz in 19.1 talks about unsafe allowing values to be uninitialized, but 19.1 doesn't teach that #15

Open bhamiltoncx opened 1 year ago

bhamiltoncx commented 1 year ago

URL to the section(s) of the book with this problem:

https://github.com/cognitive-engineering-lab/rust-book/blob/1537ac115e08f2945e98c6a6664f0b4bfdbc75e4/quizzes/ch19-01-unsafe-rust.toml#L62

Description of the problem:

The quiz in section 19.1 says it's reasonable to use unsafe to allow values to be uninitialized, but section 19.1 doesn't talk about that anywhere.

Suggested fix:

Update section 19.1 of the book to talk about using unsafe to allow values to be uninitialized, or remove this from the quiz.

willcrichton commented 1 year ago

This is intentional. The question talks about references to stack-allocated values, and those aren't discussed in 19.1 either. The goal of the question is to involve more general reasoning about what is unsafe in Rust.