Skip to content

Bool literals gt comparison causes a strange warning #37047

Closed
@tldrlol

Description

@tldrlol

The following program causes a strange warning when run on rust playground nightly:

fn main() {
    true > false;
}
warning: can't do this op on bools, #[warn(const_err)] on by default
 --> <anon>:2:5
  |
2 |     true > false;
  |     ^^^^^^^^^^^^

However this version compiles cleanly:

fn main() {
    let t = true;
    t > false;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions