Skip to content

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

Closed
@qualitysoftwareguy

Description

@qualitysoftwareguy
  • 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 rust-lang/rust#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".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions