Skip to content

Commit 2f63507

Browse files
committed
clarifications
1 parent c6719b5 commit 2f63507

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/patterns.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ They are refutable when they refer to refutable constants or enum variants for e
776776
When a constant `C` of type `T` is used as a pattern, we first check that `T: PartialEq`.
777777
Furthermore we require that the value of `C` *has (recursive) structural equality*, which is defined recursively as follows:
778778

779-
- Integers as well as `bool` and `char` values always have structural equality.
779+
- Integers as well as `str`, `bool` and `char` values always have structural equality.
780780
- Tuples, arrays, and slices have structural equality if all their fields/elements have structural equality.
781781
(In particular, `()` and `[]` always have structural equality.)
782782
- References have structural equality if the value they point to has structural equality.
@@ -787,7 +787,7 @@ Furthermore we require that the value of `C` *has (recursive) structural equalit
787787
- Nothing else has structural equality.
788788

789789
In particular, the value of `C` must be known at pattern-building time (which is pre-monomorphization).
790-
This means that associated consts cannot be used as patterns.
790+
This means that associated consts that involve generic parameters cannot be used as patterns.
791791

792792
After ensuring all conditions are met, the constant value is translated into a pattern, and now behaves exactly as-if that pattern had been written directly.
793793
In particular, it fully participates in exhaustiveness checking.

0 commit comments

Comments
 (0)