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

[BUG] Regression with Panic for Format API #157

Closed
Alexhuszagh opened this issue Sep 20, 2024 · 1 comment · Fixed by #158
Closed

[BUG] Regression with Panic for Format API #157

Alexhuszagh opened this issue Sep 20, 2024 · 1 comment · Fixed by #158
Assignees
Labels
bug Something isn't working format affects the formatting API high priority High priority regression Performance regressions.
Milestone

Comments

@Alexhuszagh
Copy link
Owner

Description

When attempting to parse feature floats without the compact feature with digit separators, there is a panic due to Self::IS_CONTIGUOUS. This seems to be an incorrect attempt to parse multi-digit separators and a test must be introduced to avoid regressions.

@Alexhuszagh Alexhuszagh added bug Something isn't working regression Performance regressions. high priority High priority format affects the formatting API labels Sep 20, 2024
@Alexhuszagh Alexhuszagh self-assigned this Sep 20, 2024
@Alexhuszagh Alexhuszagh added this to the 1.0.2 milestone Sep 20, 2024
@Alexhuszagh
Copy link
Owner Author

Alexhuszagh commented Sep 20, 2024

A minimal failing test case is:

#[test]
#[cfg(feature = "format")]
fn f64_exponent_consecutive_digit_separator_test() {
    const FORMAT: u128 = rebuild(format::PERMISSIVE)
        .exponent_internal_digit_separator(true)
        .exponent_consecutive_digit_separator(true)
        .digit_separator(num::NonZeroU8::new(b'_'))
        .build();
    let options = Options::new();
    assert!(f64::from_lexical_with_options::<FORMAT>(b"31.01e7__1", &options).is_ok());
    assert!(f64::from_lexical_with_options::<FORMAT>(b"31.01e_71", &options).is_err());
    assert!(f64::from_lexical_with_options::<FORMAT>(b"31.01e71_", &options).is_err());
}

Here, the integer and fraction digits are consecutive, so it should be able to use multi-digit optimizations, even if the exponent is not. It seems to be using is_contiguous on the byte and not the actual external iterator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working format affects the formatting API high priority High priority regression Performance regressions.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant