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

--print-config current with use_small_heuristics = "Off": Could not output config: out-of-range value for u64 type #6364

Open
antifuchs opened this issue Oct 9, 2024 · 2 comments

Comments

@antifuchs
Copy link

I'm attempting to detect whether a project has unstable rustfmt features configured, and was hoping to use rustfmt to detect that. However, with a config file like:

edition = "2021"

condense_wildcard_suffixes = true
error_on_line_overflow = true
format_code_in_doc_comments = true
format_macro_bodies = true
format_macro_matchers = true
format_strings = true
group_imports = "StdExternalCrate"
hex_literal_case = "Upper"
imports_granularity = "Crate"
max_width = 80
newline_style = "Unix"
reorder_impl_items = true
use_field_init_shorthand = true
use_small_heuristics = "Off"
use_try_shorthand = true
wrap_comments = true

running the following only prints an error:

:;    rustfmt +nightly --print-config current main.rs
Could not output config: out-of-range value for u64 type

I would expect that config file to re-serialize correctly, as the formatter does do the work according to the config.

@ytmimi
Copy link
Contributor

ytmimi commented Oct 9, 2024

@antifuchs thanks for the report. What version of rustfmt are you using? Also, are all of these configs relevant to reproduce the error? Can you make the reproducible test case smaller?

@antifuchs
Copy link
Author

This happens on both rustfmt 1.7.1-stable (eeb90cda 2024-09-04) and rustfmt 1.8.0-nightly (9ff5fc4ffb 2024-10-03).

I've reduced the config file that triggers that issue to the following:

use_small_heuristics = "Off"

Only Off triggers this, both Default and Max values result in correctly-written config. I'll adjust the issue title.

@antifuchs antifuchs changed the title --print-config current: Could not output config: out-of-range value for u64 type --print-config current with use_small_heuristics = "Off": Could not output config: out-of-range value for u64 type Oct 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants