Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

constant evaluation should not mask overflow for cases that are otherwise checked #22531

Closed

Description

@pnkfelix

While working on rebasing #20795 I discovered that the new run-fail tests it adds were failing to panic, because the arithmetic in question was being handled by the constant evaluation, and the overflow was thus happening at compile time rather than run time.

An example of such an expression:

fn main() {
    let x = 200u8 + 200u8 + 200u8;
}

(Thank goodness it didn't cause my rustc to panic! That would have been a bit frustrating.)

Anyway, we should fix that, as part of #22020.

That is, the program above should fail to compile, and it should not cause an ICE; it should signal a proper error message saying that the arithmetic expression overflowed (because 200+200+200 == 600 > 255 == u8::MAX).

Activity

  1. oli-obk commented on Feb 19, 2015

    @oli-obk
    Contributor
  2. pnkfelix commented on Feb 28, 2015

    @pnkfelix
    ContributorAuthor

    nominating, P-backcompat-lang. Suggest 1.0 polish.

    Though arguably that combination is oxymoronic, and we should instead classify as 1.0 beta.

  3. pnkfelix commented on Feb 28, 2015

    @pnkfelix
    ContributorAuthor

    I'm going to actually add the tag and milestone myself, in anticipation of @nrc's triage service...

  4. added this to the 1.0 milestone on Feb 28, 2015
  5. pnkfelix commented on Mar 31, 2015

    @pnkfelix
    ContributorAuthor
  6. added a commit that references this issue on Apr 1, 2015
    4f643d7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-type-system

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions