Skip to content

Commit 8a623e6

Browse files
authored
Rollup merge of #78793 - camelid:fixup-structuraleq, r=jyn514
Clean up `StructuralEq` docs
2 parents b249844 + b813c72 commit 8a623e6

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

library/core/src/marker.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -156,18 +156,18 @@ pub trait StructuralPartialEq {
156156
/// Required trait for constants used in pattern matches.
157157
///
158158
/// 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`.
160160
///
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.
162162
///
163-
/// Background:
163+
/// # Background
164164
///
165165
/// We want to require that types of consts used in pattern matches
166166
/// have the attribute `#[derive(PartialEq, Eq)]`.
167167
///
168168
/// 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)`,
171171
/// and be a case that we want the compiler to accept, and yet the constant's
172172
/// type fails to implement `Eq`.
173173
///
@@ -176,8 +176,11 @@ pub trait StructuralPartialEq {
176176
/// ```rust
177177
/// #[derive(PartialEq, Eq)]
178178
/// struct Wrap<X>(X);
179+
///
179180
/// fn higher_order(_: &()) { }
181+
///
180182
/// const CFN: Wrap<fn(&())> = Wrap(higher_order);
183+
///
181184
/// fn main() {
182185
/// match CFN {
183186
/// CFN => {}

0 commit comments

Comments
 (0)