-
Notifications
You must be signed in to change notification settings - Fork 901
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
[stdsimd] cargo fmt --all succeeds but subsequent cargo fmt --all -- --check fails #2787
Comments
cc @nrc |
update: the integration tests for Once this is fixed those tests should prevent it from becoming broken again. |
This is still reproducible with the latest rustfmt ( Why do |
I figured that rustfmt silently crashes when formatting stdsimd/crates/src/lib.rs. In particular, this module declaration seems to break rustfmt. |
EDIT: Ignore this comment, this is wrong 😞 Ok, so the actual file that breaks rustfmt is stdsimd/stdsimd/mod.rs, and the relevant code is this: /// ```ignore
/// #[cfg(all(any(target_arch = "x86", target_arch = "x86_64"),
/// target_feature = "avx2"))]
/// fn foo() {
/// #[cfg(target_arch = "x86")]
/// use std::arch::x86::_mm256_add_epi64;
/// #[cfg(target_arch = "x86_64")]
/// use std::arch::x86_64::_mm256_add_epi64;
///
/// unsafe {
/// _mm256_add_epi64(...);
/// }
/// }
/// ```
Note that the third line should be prefixed with |
I am still unsure why rustfmt started to fail silently against invalid code, I guess there is something weird going on inside |
#2787 (comment) was wrong 😞 It was a pure bug in the rustfmt side. #2895 should fix this. |
Closed via #2895. |
Did this land on the nightly preview yet? Or could you ping me when it does? |
It hasn't because we've had some problems in the Rust repo. It is in the queue, so as soon as there is a new nightly, it should have this fix in it. |
With this PR
cargo fmt --all
currently outputs nothing and returns0
(EXIT_SUCCESS
). A subsequent call tocargo fmt --all -- --check
returns101
and sometimes (1/5 times) prints the following diff. Other times it doesn't print anything, just fails with that error (e.g. like here: https://travis-ci.org/rust-lang-nursery/stdsimd/jobs/392688468#L472):We should add to CI a check that after formatting
cargo fmt --all -- --check
should returntrue
and if not fail the integration tests.The text was updated successfully, but these errors were encountered: