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

Bool literals gt comparison causes a strange warning #37047

Closed
tldrlol opened this issue Oct 9, 2016 · 1 comment
Closed

Bool literals gt comparison causes a strange warning #37047

tldrlol opened this issue Oct 9, 2016 · 1 comment

Comments

@tldrlol
Copy link

tldrlol commented Oct 9, 2016

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;
}
@durka
Copy link
Contributor

durka commented Oct 9, 2016

cc @oli-obk

sophiajt pushed a commit to sophiajt/rust that referenced this issue Oct 11, 2016
…, r=bluss

Add comparison operators to boolean const eval.

I think it might be worth adding tests here, but since I don't know how or where to do that, I have not done so yet. Willing to do so if asked and given an explanation as to how.

Fixes rust-lang#37047.
alexcrichton added a commit to alexcrichton/rust that referenced this issue Oct 12, 2016
…, r=bluss

Add comparison operators to boolean const eval.

I think it might be worth adding tests here, but since I don't know how or where to do that, I have not done so yet. Willing to do so if asked and given an explanation as to how.

Fixes rust-lang#37047.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants