Skip to content
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

False warning of multiple patterns overlaping #120052

Closed
zdila opened this issue Jan 17, 2024 · 1 comment
Closed

False warning of multiple patterns overlaping #120052

zdila opened this issue Jan 17, 2024 · 1 comment
Labels
C-bug Category: This is a bug.

Comments

@zdila
Copy link

zdila commented Jan 17, 2024

rustc version: rustc 1.75.0 (82e1608 2023-12-21)

relevant settings: nothing

Following code reports a warning:

pub fn test() {
  let zoom = 2;
  let class = "foo";

  match (zoom, class) {
      (13.., "railway") => {}
      (12..=13, "highway") => {}
      _ => {}
  }
}
warning: multiple patterns overlap on their endpoints
 --> src/test.rs:7:8
  |
6 |       (13.., "railway") => {}
  |        ---- this range overlaps on `13_i32`...
7 |       (12..=13, "highway") => {}
  |        ^^^^^^^ ... with this range
  |
  = note: you likely meant to write mutually exclusive ranges

But branches are mutually exclusive because of the second element in the tuple.

The code is a minimal testcase. Original code contains much more branches (ranges, classes, predicates)

@zdila zdila added the C-bug Category: This is a bug. label Jan 17, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 17, 2024
@fmease
Copy link
Member

fmease commented Jan 17, 2024

Thanks for your report! However, this is already fixed on nightly.
Closing as duplicate of #117648.

@fmease fmease closed this as not planned Won't fix, can't repro, duplicate, stale Jan 17, 2024
@fmease fmease removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

3 participants