book icon indicating copy to clipboard operation
book copied to clipboard

Chapter 18.2: Irrefutable Patterns Cause a Warning with "if let" and "while let"

Open qualitysoftwareguy opened this issue 2 years ago • 0 comments
trafficstars

  • I have searched open and closed issues and pull requests for duplicates, using these search terms: " chapter 18.2" "irrefutable patterns"

  • I have checked the latest main branch to see if this has already been fixed, in this file: Yes

URL to the section(s) of the book with this problem: https://doc.rust-lang.org/book/ch18-02-refutability.html

Description of the problem: The book currently states that using an irrefutable pattern with an "if let" will cause the compiler to give an error: "This code is perfectly valid, although it means we cannot use an irrefutable pattern without receiving an error." However, this behavior was changed (in https://github.com/rust-lang/rust/issues/44495) so that a warning is now produced.

Suggested fix: From the above sentence, change "will cause the compiler to give an error" to "will cause the compiler to give a warning".

qualitysoftwareguy avatar Jul 15 '23 02:07 qualitysoftwareguy