Skip to content

Conversation

@theemathas
Copy link
Contributor

This changes the reference to match the behavior of the compiler, based on my empirical testing.

See also rust-lang/rust#149165

This changes the reference to match the behavior of the compiler, based on my empirical testing.

See also rust-lang/rust#149165
@rustbot rustbot added the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Nov 21, 2025
That is, in `a..=b`, a ≤ b must be the case.
For example, it is an error to have a range pattern `10..=0`.
r[patterns.range.constraint-nonempty]
A range pattern must match at least one possible value. In other words:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wording here seemed little strange to me. Does this make sense? Obviously range patterns that are outside the range of the scrutinee won't match the value at all.

Suggested change
A range pattern must match at least one possible value. In other words:
A range pattern must be able to match at least one possible value. In other words:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wrote it this way to be consistent with the other lines in this section, for example:

The exclusive range pattern matches all values from the lower bound up to, but not including the upper bound.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: The marked PR is awaiting review from a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants