You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Incorrect "struct_variant_width cannot have a value that exceeds max_width" when using macros #7147
Using struct_variant_width = 0 config option triggers an incorrect warning when encountering a macro.
Using this code:
macro_rules! m {() => {};}
With config struct_variant_width =0, gives the following warning
`struct_variant_width` cannot have a value that exceeds `max_width`. `struct_variant_width` will be set to the same value as `max_width`
Potential Clause
Claude Opus 5.5 minimized this bug. It thinks the issue was introduced by PR #6651. The new adjust_max_width function will underflow if any of the width configs are smaller than the indenetation (permalink).
fnadjust_max_width(&mutself,delta:isize){// overflows whenever value < -deltalet adjust = |value:usize| (value asisize + delta)asusize;// if `self.array_width = 0`, this will overflow for delta < 0self.array_width.2 = adjust(self.array_width.2);// <similar adjustments>self.struct_variant_width.2 = adjust(self.struct_variant_width.2);// this is likely causing the issueself.max_width.2 = adjust(self.max_width.2);self.set_heuristics();}
This seems like a resonable theory, but I have not yet confirmed it.
Activity
test(config): add regression test for `adjust_max_width` overflows
test(config): add regression test for `adjust_max_width` overflows
test(config): add regression test for `adjust_max_width` overflows
Auto merge of #163547 - jieyouxu:rustfmt-beta-backport, r=ytmimi