-
Notifications
You must be signed in to change notification settings - Fork 1.6k
correctly check exclusive range patterns for overlap #1490
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
Conversation
5d8a648
to
aebdf74
Compare
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.
r+ modulo small nits
@@ -246,11 +247,35 @@ fn overlapping() { | |||
} | |||
|
|||
match 42 { | |||
2 => println!("2"), //~NOTE overlaps with this | |||
0 ... 2 => println!("0 ... 5"), //~ERROR: some ranges overlap |
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.
The string is wrong here.
|
||
match 42 { | ||
0 .. 10 => println!("0 ... 10"), | ||
10 .. 50 => println!("0 ... 10"), |
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.
Same.
} | ||
|
||
match 42 { | ||
0 .. 11 => println!("0 ... 10"), //~ERROR: some ranges overlap |
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.
Same.
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's kind of correct
|
||
match 42 { | ||
0 .. 11 => println!("0 ... 10"), //~ERROR: some ranges overlap | ||
0 ... 11 => println!("0 ... 10"), //~NOTE overlaps with this |
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.
Same.
(Bound::Included(a), Bound::Included(b)) | | ||
(Bound::Excluded(a), Bound::Excluded(b)) => a.cmp(&b), | ||
(Bound::Unbounded, _) | | ||
(_, Bound::Unbounded) => unimplemented!(), |
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.
Maybe add a comment that range patterns need to be bounded? I did not know that and had to check.
No description provided.