Skip to content

Commit e2ac2c6

Browse files
committed
properly recurse through references
1 parent 8590388 commit e2ac2c6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

text/0000-constants-in-patterns.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,10 @@ Most of the values of primitive Rust types have structural equality (integers, `
123123
When a constant `C` of type `T` is used as a pattern, we first check that `T: PartialEq`.
124124
Furthermore we require that the value of `C` *has (recursive) structural equality*, which is defined recursively as follows:
125125

126-
- Integers, `bool` and `char` values, and references always have structural equality.
126+
- Integers as well as `bool` and `char` values always have structural equality.
127127
- Tuples, arrays, and slices have structural equality if all their fields/elements have structural equality.
128128
(In particular, `()` and `[]` always have structural equality.)
129+
- References have structural equality if the value they point to has structural equality.
129130
- A value of `struct` or `enum` type has structural equality if its `PartialEq` behaves exactly like the one generated by `derive(PartialEq)`,
130131
and all fields (for enums: of the active variant) have structural equality.
131132
- A raw pointer has structural equality if it was defined as a constant integer (and then cast/transmuted).

0 commit comments

Comments
 (0)