|
9 | 9 | When a constant appears as a pattern, this is syntactic sugar for writing a pattern that corresponds to the constant's value by hand.
|
10 | 10 | This operation is only allowed when (a) the type of the constant implements `PartialEq`, and (b) the *value* of the constant being matched on has "structural equality", which means that `PartialEq` behaves the same way as that desugared pattern.
|
11 | 11 |
|
| 12 | +This RFC does not allow any new code, compared to what already builds on stable today. |
| 13 | +Its purpose is to explain the rules for constants in patterns in one coherent document, |
| 14 | +and to justify why we will start *rejecting* some code that currently works (see the [breaking changes](#breaking-changes) below). |
| 15 | + |
12 | 16 | # Motivation
|
13 | 17 | [motivation]: #motivation
|
14 | 18 |
|
@@ -190,11 +194,11 @@ This RFC breaks code that compiles today, but only code that already emits a fut
|
190 | 194 | This only recently landed (Rust 1.75, currently in beta), and is not currently shown in dependencies.
|
191 | 195 | Crater found [three cases](https://github.com/rust-lang/rust/pull/116930#issuecomment-1784648989) across the ecosystem where `match` was used to compare function pointers;
|
192 | 196 | that code is buggy for the reasons mentioned above that make comparing function pointers unreliable.
|
193 |
| -- Matching on floats triggers `illegal_floating_point_literal_pattern`. This triggers on *all* float matches, not just the forbidden ones. |
| 197 | +- Matching on floats triggers `illegal_floating_point_literal_pattern`. This triggers on *all* float matches, not just the ones forbidden by this RFC. |
194 | 198 | It has been around for years, but is not currently shown in dependencies.
|
195 | 199 |
|
196 | 200 | When the RFC gets accepted, the floating-point lint should be adjusted to only cover the cases we are really going to reject,
|
197 |
| -and all of them should be shown in dependencies. |
| 201 | +and all of them should be shown in dependencies or directly turned into hard errors. |
198 | 202 |
|
199 | 203 | ## Compiler/library cleanup
|
200 | 204 |
|
|
0 commit comments