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

Parses invalid versions with leading 0 in numeric prerelease identifiers #206

Closed
Nemo157 opened this issue May 2, 2020 · 1 comment
Closed
Labels

Comments

@Nemo157
Copy link

Nemo157 commented May 2, 2020

repro (playground):

fn main() {
    println!("{:#?}", semver::Version::parse("1.0.0-alpha.01"));
}

prints:

Ok(
    Version {
        major: 1,
        minor: 0,
        patch: 0,
        pre: [
            AlphaNumeric(
                "alpha",
            ),
            AlphaNumeric(
                "01",
            ),
        ],
        build: [],
    },
)

when it should be some form of error.

See semver/semver#563 for clarification that this should be an error case, and cc downstream bug rust-lang/crates.io#2463.

@Nemo157 Nemo157 changed the title Parses invalid versions with leading 0 in numeric prerelease indentifiers Parses invalid versions with leading 0 in numeric prerelease identifiers May 3, 2020
@dtolnay
Copy link
Owner

dtolnay commented May 25, 2021

This is fixed in 1.0.0.

fn main() {
    println!("{}", semver::Version::parse("1.0.0-alpha.01").unwrap_err());
}
invalid leading zero in pre-release identifier

@dtolnay dtolnay closed this as completed May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants