-
Notifications
You must be signed in to change notification settings - Fork 911
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
rustfmt silently removes code it can't parse #4315
Comments
rustfmt should bail on non-parseable inputs today; for example, fn f( {
} fails quickly with a number of rustc parser error messages. The problem here is probably that rustfmt just isn't try to format the generic bound of the associated type. |
I think this was fixed (but not yet released) in https://github.com/rust-lang/rustfmt/pull/4106/files#diff-d5afe6fbd84797013d4e4b0fc11d83e9R540-R541 but we don't seem to have any tests for it |
This was fixed in 1e9af9f but it seems that a test was never added. Closes rust-lang#4315
Describe the bug
Currently, when rustfmt tries to format code which e.g. uses
feature(generic_associated_types)
, rustfmt produces no error messages, but removes code which causes previously working examples to fail compiling after formatting usingrustfmt
.To Reproduce
The following diff describes the change currently performed by rustfmt:
Expected behavior
Rustfmt should fail with either "Error writing files: failed to resolve mod
...
: cannot parse /...rs", or a more concise error message;and skip the offending modules (not modifying them, except maybe removing simple stuff like trailing whitespace and double-newlines, which don't require fully parsed code) and all submodules of them.
Meta
rustfmt 1.4.18-nightly (c1e9b7b 2020-06-13)
rustup
cargo fmt
The text was updated successfully, but these errors were encountered: