Skip to content

Commit fe92756

Browse files
committed
note that the implementation does not match the RFC
1 parent bd37599 commit fe92756

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

patterns.md

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ fn is_foo(x: i32) -> bool {
1414
However, that check has some loopholes, so e.g. `&T` can be used in a pattern no matter the `T`.
1515

1616
Any reference type const-pattern is compiled by [calling `PartialEq::eq`][compile-partial-eq] to compare the subject of the `match` with the constant. Const-patterns with other types (enum, struct, tuple, array) are treated as if the constant was inlined as a pattern (and the usual `match` tree is constructed).
17+
Note that this is in contradiction with what has been RFC'd, which specifies that we should always call `PartialEq::eq`.
1718

1819
[struct-eq]: https://github.com/rust-lang/rust/blob/2c28244cf0fc9868f55070e55b8f332d196eaf3f/src/librustc_mir_build/hair/pattern/const_to_pat.rs#L121
1920
[compile-partial-eq]: https://github.com/rust-lang/rust/blob/2c28244cf0fc9868f55070e55b8f332d196eaf3f/src/librustc_mir_build/build/matches/test.rs#L355

0 commit comments

Comments
 (0)