Skip to content

Regression involving "is not a logical operator" in match #75599

Closed

Description

@dtolnay

The following used to work from rust 1.0.0 through 1.41.0, but has been failing to compile since 1.42.0. I believe the "`and` is not a logical operator" diagnostic is being overzealous and should not be triggering on this program.

mod or {
    pub const ID: usize = 0;
}

mod and {
    pub const ID: usize = 1;
}

fn main() {
    match 0 {
        or::ID => {}
        and::ID => {}
        _ => {}
    }
}
error: `and` is not a logical operator
  --> src/main.rs:12:9
   |
12 |         and::ID => {}
   |         ^^^ help: use `&&` to perform logical conjunction
   |
   = note: unlike in e.g., python and PHP, `&&` and `||` are used for logical operators

Activity

  1. added
    A-diagnosticsArea: Messages for errors, warnings, and lints
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.
    C-bugCategory: This is a bug.
    on Aug 16, 2020
  2. added
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Aug 16, 2020
  3. dtolnay commented on Aug 16, 2020

    @dtolnay
    MemberAuthor

    Likely introduced in #66994.

  4. added
    A-parserArea: The lexing & parsing of Rust source code to an AST
    on Aug 16, 2020
  5. tgnottingham commented on Aug 17, 2020

    @tgnottingham
    Contributor

    @rustbot claim

  6. added 3 commits that reference this issue on Aug 19, 2020
    24e6035
    7954f00
    5eee694
  7. added a commit that references this issue on Aug 19, 2020
    e6fe523
  8. removed
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Aug 19, 2020
  9. added a commit that references this issue on Aug 22, 2020
    0cd951c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions