Skip to content

-(-0.0) raises const_err "attempt to negate with overflow" #64059

Closed
@sinkuu

Description

@sinkuu
fn main() {
    let _ = -(-0.0);
}
error: this expression will panic at runtime
 --> test.rs:2:13
  |
2 |     let _ = -(-0.0);
  |             ^^^^^^^ attempt to negate with overflow
  |
  = note: `#[deny(const_err)]` on by default

error: aborting due to previous error
Meta
rustc 1.39.0-nightly (fba38ac27 2019-08-31)
binary: rustc
commit-hash: fba38ac27e2ade309f4c2504a6d6cd3556972a28
commit-date: 2019-08-31
host: x86_64-unknown-linux-gnu
release: 1.39.0-nightly
LLVM version: 9.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions