Skip to content

Parsing "-" as integer incorrectly gives Ok(0) #22745

@krdln

Description

@krdln
Contributor

Assertion in the following code is accepted, which breaks the behaviour I was relying on.

fn main() {
    assert_eq!("-".parse(), Ok(0)); 
}

This bug has been present already on 2014-11-21.

It's one-line fix, I'll try making a PR.

Activity

Aatch

Aatch commented on Feb 24, 2015

@Aatch
Contributor

Heh, that's kind of amusing.

changed the title [-]Parsing `"-"` as integer incorrectly gives `Ok(0)`[/-] [+]Parsing "-" as integer incorrectly gives Ok(0)[/+] on Feb 24, 2015
added a commit that references this issue on Feb 24, 2015
948a17e
added a commit that references this issue on Feb 24, 2015
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Aatch@Gankra@krdln

        Issue actions

          Parsing "-" as integer incorrectly gives Ok(0) · Issue #22745 · rust-lang/rust