The old example is wrong. It would be refutable if the expression becomes if let ..., but it in the old case, with just a let ... it is irrefutable. That this example is refutable is contradicted by the next paragraph. It also gives a compiler error when given by itself (refutable pattern in local binding. pattern &[] not covered. note: let bindings require an "irrefutable pattern", like a struct or an enum with only one variant. The error specifically points to this same chapter in docs.rust-lang.org, which does not include these examples.
The old example is wrong. It would be refutable if the expression becomes
if let ...
, but it in the old case, with just alet ...
it is irrefutable. That this example is refutable is contradicted by the next paragraph. It also gives a compiler error when given by itself (refutable pattern in local binding. pattern&[]
not covered. note:let
bindings require an "irrefutable pattern", like astruct
or anenum
with only one variant. The error specifically points to this same chapter in docs.rust-lang.org, which does not include these examples.