-
Notifications
You must be signed in to change notification settings - Fork 910
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
cargo fmt crashes in Rust 1.81.0 #6333
Comments
Hey @ajewellamz what exact version of cargo fmt / rustfmt are you using. You can run Also, any chance you can get this down to a reproducible code snippet that you can add inline? That would be best. rustfmt can run just fine on code that doesn't compile (as long as it parses) so my suggestion would be to slowly remove function, struct, enum, macro, and trait definitions / impls from the file until you're able to narrow down what's causing the issue. It would be a great help 🙏🏼 |
rustfmt 1.7.1-stable (eeb90cda 2024-09-04) I won't be able to do any work on this until next week at the earliest. |
Ok, here's a minimal fail case. I've tried deleting various parts, and it seems to always succeed. pub use ::dafny_runtime::Sequence;
pub use ::std::rc::Rc;
pub use crate::r#_StructuredEncryptionUtil_Compile::CanonCryptoItem;
pub use ::dafny_runtime::itertools::Itertools;
pub use crate::software::amazon::cryptography::dbencryptionsdk::structuredencryption::internaldafny::types::CryptoAction;
pub use crate::software::amazon::cryptography::materialproviders::internaldafny::types::EncryptedDataKey;
pub use ::dafny_runtime::Object;
pub use crate::software::amazon::cryptography::primitives::internaldafny::types::IAwsCryptographicPrimitivesClient;
pub use crate::software::amazon::cryptography::materialproviders::internaldafny::types::AlgorithmSuiteInfo;
pub use ::dafny_runtime::DafnyCharUTF16;
pub use crate::r#_StructuredEncryptionUtil_Compile::MessageID;
pub use crate::software::amazon::cryptography::materialproviders::internaldafny::types::EncryptionMaterials;
pub use crate::r#_Wrappers_Compile::Outcome;
pub use ::dafny_runtime::string_utf16_of;
pub use ::dafny_runtime::int;
pub use ::dafny_runtime::MapBuilder;
pub use ::dafny_runtime::_System::nat;
pub use crate::software::amazon::cryptography::primitives::internaldafny::types::HMacInput;
pub use ::dafny_runtime::rd;
pub use ::dafny_runtime::truncate;
pub use ::dafny_runtime::DafnyTypeEq;
pub use ::dafny_runtime::DafnyType; |
Thanks! confirming that with Backtrace
|
I just ran into this trying to rustfmt some pretty terrifying expanded macro code. I found the reduced example above more useful to debug than the mess I had. I was not particularly successful in finding the issue but the issue appears to be in Lines 922 to 933 in 6157568
|
Still broken in Rust 1.82, not surprising since rustfmt is still 1.7.1-stable |
I was trying to fix this myself, but I'm having trouble building it. I assumed that all I had to do was
but that fails to build, with 40 compile time errors in various file within src/tools/rustfmt/src Am I missing something? |
You want to clone the rustfmt repo, not the
|
Thanks, that works. I've found the problem, but I'm not sure of the proper fix In
let A = DafnyType A < B by 5) hence |
Fixed in #6375 |
lib.rs.gz
Un-gzip the attached lib.rs
make it the only file in a crate
run
cargo fmt
See
As an aside - with previous versions of Rust, cargo fmt also failed on this file.
It didn't crash, but it left trailing spaces on some lines, and then reported failure.
The text was updated successfully, but these errors were encountered: