You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#[derive(PartialEq)] // code fails to build if we remove this or replace it by a manual impl
@@ -101,11 +101,11 @@ This means the eligibility of a constant for a pattern depends on its value, not
101
101
That is already the case on stable Rust for many years and relied upon by widely-used crates such as [`http`](https://github.com/rust-lang/rust/issues/62411#issuecomment-510604193).
102
102
103
103
Overall we say that the *value* of the constant must have recursive structural equality,
104
-
which is the case when all the types that actually appear recursively in the type (ignoring "other" enum variants) have structural equality.
104
+
which is the case when all the types that actually appear recursively in the value (ignoring "other" enum variants) have structural equality.
105
105
106
106
Most of the values of primitive Rust types have structural equality (integers, `bool`, `char`, references), but two families of types need special consideration:
107
107
108
-
- Pointer types (raw pointers and function pointers): these compare by test the memory address for equality.
108
+
- Pointer types (raw pointers and function pointers): these compare by testing the memory address for equality.
109
109
It is unclear whether that should be considered "structural", but it is fairly clear that this should be considered a bad idea:
110
110
Rust makes basically no guarantees for when two function pointers are equal or unequal
111
111
(the "same" function can be duplicated across codegen units and this have different addresses,
@@ -184,7 +184,7 @@ Range patterns are only allowed on integers, `char`, and floats; for floats, nei
184
184
185
185
The *behavior* of such a constant as a pattern is the same as the corresponding native pattern.
186
186
On floats are raw pointers, pattern matching behaves like `==`,
187
-
which means in particular that the value `-0.0` matches the pattern `0.0`, and NaN values match no pattern.
187
+
which means in particular that the value `-0.0` matches the pattern `0.0`, and NaN values match no pattern (except for wildcards).
0 commit comments