Skip to content

Future compatiblity warning: {:.*} precision will be limited to u16::MAX in future Rust version #1

@m-ou-se

Description

@m-ou-se

Hi there!

In the Rust compiler and standard library we're planning to limit the width and precision formatting options to a u16. This means that, in a future version of Rust, this line will panic when max_len is larger than u16::MAX:

let result = format!("{:.*}", max_len, s);

This is the only code we found on all of Crates.io and GitHub that triggers the new runtime panic. This is a heads-up to give you the time to adjust your code. Apologies for breaking your code.

See rust-lang/rust#136932 for more information.

If you have any thoughts or concerns about the planned change, feel free to leave a comment on that pull request.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions