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
Thanks for the wonderful Clippy. I hope this bug report is helpful.
I have a C library that was translated by C2Rust and heavily cleaned up by hand. Alas, the terrible code that you (understandably) get from C2Rust seems to break Clippy's --fix option.
Reproducer
To reproduce: git clone https://github.com/tommythorn/repro-clippy-bug;cd repro-clippy-bug;cargo clippy --fix
With Rust 1.81.0 (eeb90cda1 2024-09-04) on macOS (but I think this happens on Linux also) I get
warning: failed to automatically apply fixes suggested by rustc to crate `repro_clippy_bug`
after fixes were automatically applied the compiler reported errors within these files:
* src/softfloat/f128_to_f16.rs
* src/softfloat/f16_div.rs
* src/softfloat/f16_mul.rs
* src/softfloat/f16_roundToInt.rs
* src/softfloat/f32_to_f16.rs
* src/softfloat/f64_to_f16.rs
* src/softfloat/s_addMagsF16.rs
* src/softfloat/s_mulAddF16.rs
* src/softfloat/s_subMagsF16.rs
This likely indicates a bug in either rustc or cargo itself,
and we would appreciate a bug report! You're likely to see
a number of compiler warnings after this message which cargo
attempted to fix but failed. If you could open an issue at
https://github.com/rust-lang/rust-clippy/issues
quoting the full output of this command we'd be very appreciative!
Note that you may be able to make some more progress in the near-term
fixing code with the `--broken-code` flag
The following errors were reported:
warning: operator precedence can trip the unwary
--> src/softfloat/f16_roundToInt.rs:22:15
|
22 | uiZ = uiA
| _______________^
23 | | & ((1_i32 as u16 as i32) << 15_i32) + ((0_i32 as u16 as i32) << 10_i32)
24 | | as u64;
| |______________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#precedence
= note: `#[warn(clippy::precedence)]` on by default
help: consider parenthesizing your expression
|
22 ~ uiZ = uiA & (((1_i32 as u16 as i32) << 15_i32) + ((0_i32 as u16 as i32) << 10_i32)
23 ~ as u64);
|
.... and a *LOT* more of this
Summary
Thanks for the wonderful Clippy. I hope this bug report is helpful.
I have a C library that was translated by C2Rust and heavily cleaned up by hand. Alas, the terrible code that you (understandably) get from C2Rust seems to break Clippy's --fix option.
Reproducer
To reproduce:
git clone https://github.com/tommythorn/repro-clippy-bug;cd repro-clippy-bug;cargo clippy --fix
With Rust 1.81.0 (eeb90cda1 2024-09-04) on macOS (but I think this happens on Linux also) I get
Version
rustc 1.81.0 (eeb90cda1 2024-09-04)
binary: rustc
commit-hash: eeb90cda1969383f56a2637cbd3037bdf598841c
commit-date: 2024-09-04
host: x86_64-apple-darwin
release: 1.81.0
LLVM version: 18.1.7
Additional Labels
No response
The text was updated successfully, but these errors were encountered: