Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign up[stdsimd] cargo fmt --all succeeds but subsequent cargo fmt --all -- --check fails #2787
Comments
This comment has been minimized.
This comment has been minimized.
|
cc @nrc |
This was referenced Jun 15, 2018
nrc
added
the
bug
label
Jun 18, 2018
This comment has been minimized.
This comment has been minimized.
|
update: the integration tests for Once this is fixed those tests should prevent it from becoming broken again. |
This was referenced Jul 31, 2018
nrc
added this to the 1.0 (rc) milestone
Aug 4, 2018
nrc
added
the
p-high
label
Aug 4, 2018
This comment has been minimized.
This comment has been minimized.
|
This is still reproducible with the latest rustfmt ( Why do |
This comment has been minimized.
This comment has been minimized.
|
I figured that rustfmt silently crashes when formatting stdsimd/crates/src/lib.rs. In particular, this module declaration seems to break rustfmt. |
This comment has been minimized.
This comment has been minimized.
|
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 |
This comment has been minimized.
This comment has been minimized.
|
I am still unsure why rustfmt started to fail silently against invalid code, I guess there is something weird going on inside |
This comment has been minimized.
This comment has been minimized.
|
#2787 (comment) was wrong |
This comment has been minimized.
This comment has been minimized.
|
Closed via #2895. |
topecongiro
closed this
Aug 6, 2018
This comment has been minimized.
This comment has been minimized.
|
Did this land on the nightly preview yet? Or could you ping me when it does? |
This comment has been minimized.
This comment has been minimized.
|
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. |
gnzlbg commentedJun 15, 2018
•
edited
With this PR
cargo fmt --allcurrently outputs nothing and returns0(EXIT_SUCCESS). A subsequent call tocargo fmt --all -- --checkreturns101and 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):Diff in stdsimd/crates/stdsimd-verify/src/lib.rs at line 95: fn to_type(t: &syn::Type) -> proc_macro2::TokenStream { match *t { - syn::Type::Path(ref p) => match extract_path_ident(&p.path).to_string().as_ref() { - "__m128" => quote! { &M128 }, - "__m128d" => quote! { &M128D }, - "__m128i" => quote! { &M128I }, - "__m256" => quote! { &M256 }, - "__m256d" => quote! { &M256D }, - "__m256i" => quote! { &M256I }, - "__m64" => quote! { &M64 }, - "bool" => quote! { &BOOL }, - "f32" => quote! { &F32 }, - "f64" => quote! { &F64 }, - "i16" => quote! { &I16 }, - "i32" => quote! { &I32 }, - "i64" => quote! { &I64 }, - "i8" => quote! { &I8 }, - "u16" => quote! { &U16 }, - "u32" => quote! { &U32 }, - "u64" => quote! { &U64 }, - "u8" => quote! { &U8 }, - "CpuidResult" => quote! { &CPUID }, - s => panic!("unspported type: {}", s), - }, + syn::Type::Path(ref p) => { + match extract_path_ident(&p.path).to_string().as_ref() { + "__m128" => quote! { &M128 }, + "__m128d" => quote! { &M128D }, + "__m128i" => quote! { &M128I }, + "__m256" => quote! { &M256 }, + "__m256d" => quote! { &M256D }, + "__m256i" => quote! { &M256I }, + "__m64" => quote! { &M64 }, + "bool" => quote! { &BOOL }, + "f32" => quote! { &F32 }, + "f64" => quote! { &F64 }, + "i16" => quote! { &I16 }, + "i32" => quote! { &I32 }, + "i64" => quote! { &I64 }, + "i8" => quote! { &I8 }, + "u16" => quote! { &U16 }, + "u32" => quote! { &U32 }, + "u64" => quote! { &U64 }, + "u8" => quote! { &U8 }, + "CpuidResult" => quote! { &CPUID }, + s => panic!("unspported type: {}", s), + } + } syn::Type::Ptr(syn::TypePtr { ref elem, .. }) | syn::Type::Reference(syn::TypeReference { ref elem, .. }) => { let tokens = to_type(&elem);We should add to CI a check that after formatting
cargo fmt --all -- --checkshould returntrueand if not fail the integration tests.