@@ -156,18 +156,18 @@ pub trait StructuralPartialEq {
156
156
/// Required trait for constants used in pattern matches.
157
157
///
158
158
/// Any type that derives `Eq` automatically implements this trait, *regardless*
159
- /// of whether its type- parameters implement `Eq`.
159
+ /// of whether its type parameters implement `Eq`.
160
160
///
161
- /// This is a hack to workaround a limitation in our type- system.
161
+ /// This is a hack to work around a limitation in our type system.
162
162
///
163
- /// Background:
163
+ /// # Background
164
164
///
165
165
/// We want to require that types of consts used in pattern matches
166
166
/// have the attribute `#[derive(PartialEq, Eq)]`.
167
167
///
168
168
/// In a more ideal world, we could check that requirement by just checking that
169
- /// the given type implements both (1.) the `StructuralPartialEq` trait *and*
170
- /// (2.) the `Eq` trait. However, you can have ADTs that *do* `derive(PartialEq, Eq)`,
169
+ /// the given type implements both the `StructuralPartialEq` trait *and*
170
+ /// the `Eq` trait. However, you can have ADTs that *do* `derive(PartialEq, Eq)`,
171
171
/// and be a case that we want the compiler to accept, and yet the constant's
172
172
/// type fails to implement `Eq`.
173
173
///
@@ -176,8 +176,11 @@ pub trait StructuralPartialEq {
176
176
/// ```rust
177
177
/// #[derive(PartialEq, Eq)]
178
178
/// struct Wrap<X>(X);
179
+ ///
179
180
/// fn higher_order(_: &()) { }
181
+ ///
180
182
/// const CFN: Wrap<fn(&())> = Wrap(higher_order);
183
+ ///
181
184
/// fn main() {
182
185
/// match CFN {
183
186
/// CFN => {}
0 commit comments