-
Notifications
You must be signed in to change notification settings - Fork 14.1k
reword error for invalid range patterns #149528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Some changes occurred in match checking cc @Nadrieril |
|
r? @SparrowLii rustbot has assigned @SparrowLii. Use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me modulo maybe a diagnostic wording nit
| fn main() { | ||
| m!(0, ..u8::MIN); | ||
| //~^ ERROR lower range bound must be less than upper | ||
| //~^ ERROR upper bound for a range pattern cannot be the minimum |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussion: this is specifically applicable to the half-open range pattern, right? Because ..=u8::MIN-the-closed-range would be fine. Maybe say
ERROR: upper bound for a half-open range pattern cannot be the minimum
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure what a half-open range means, actually.. apparently a..b is called half-open? So I'd have to investigate the wording
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It refers to one of [a, b) or (a, b] where one of the ends are exclusive. In our case, a..b is the [a, b) right-side half-open range. However, if this phrase isn't familiar to you, then we should probably not use it since you won't be the only one unfamiliar with the phrase. (I suppose this is only a familiar wording given some discrete math courses or whatever, so yeah...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it could also be phrased as, "exclusive upper bound for a range bound cannot be the minimum".
|
r? me |
|
Ignore the wording nit, feel free to r=me once PR CI is green. |
For half-open ranges, specifies that the upper bound cannot be the minimum. Also specify that this only applies to range patterns and not also expressions.
32147fe to
f8ca417
Compare
|
@bors r=jieyouxu rollup |
reword error for invalid range patterns For half-open ranges, specifies that the upper bound cannot be the minimum. Also specify that this only applies to range patterns and not also expressions. Fixes #149165
|
💔 Test failed - checks-actions |
@bors retry |
|
A job failed! Check out the build log: (web) (plain enhanced) (plain) Click to see the possible cause of the failure (guessed by this bot) |
|
Huh. Maybe transient git operation issue? |
reword error for invalid range patterns For half-open ranges, specifies that the upper bound cannot be the minimum. Also specify that this only applies to range patterns and not also expressions. Fixes #149165
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
💔 Test failed - checks-actions |
|
I suspect Tracking issue: #149575 Infra thread: #t-infra > `src/doc/reference` doctest failures. @/bors treeclosed=1000 |
For half-open ranges, specifies that the upper bound cannot be the minimum.
Also specify that this only applies to range patterns and not also expressions.
Fixes #149165