Skip to content
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

Clippy crash (version 1.59 on macOS) #8470

Closed
printfn opened this issue Feb 24, 2022 · 29 comments
Closed

Clippy crash (version 1.59 on macOS) #8470

printfn opened this issue Feb 24, 2022 · 29 comments
Labels
C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@printfn
Copy link

printfn commented Feb 24, 2022

Summary

Trying to run cargo clippy (version 1.59, macOS 12.2.1, x64) on a fresh checkout of https://github.com/printfn/fend (commit 3a392e50d45d5dce70bcdde9e22961517b895093) crashes inconsistently: after running the command 10 times (with cargo clean inbetween), it crashed exactly 5 times. It didn't used to crash on Rust 1.58.1. I have not been able to reproduce this on Linux.

The message that appears looks like this:

$ git clone [email protected]:printfn/fend.git
$ cd fend
$ cargo clippy
...
error: could not compile `fend-core`

Caused by:
  process didn't exit successfully: `/Users/printfn/.rustup/toolchains/stable-x86_64-apple-darwin/bin/clippy-driver rustc --crate-name fend_core --edition=2021 core/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,future-incompat --crate-type lib --emit=dep-info,metadata -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 --cfg 'feature="default"' -C metadata=b3e47eda875b4189 -C extra-filename=-b3e47eda875b4189 --out-dir /Users/printfn/Code/fend-copy/target/debug/deps -C incremental=/Users/printfn/Code/fend-copy/target/debug/incremental -L dependency=/Users/printfn/Code/fend-copy/target/debug/deps` (signal: 6, SIGABRT: process abort signal)
warning: build failed, waiting for other jobs to finish...
error: build failed

When I tried rerunning just the clippy-driver command that failed, I got this output:

$ /Users/printfn/.rustup/toolchains/stable-x86_64-apple-darwin/bin/clippy-driver rustc --crate-name fend_core --edition=2021 core/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,future-incompat --crate-type lib --emit=dep-info,metadata -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 --cfg 'feature="default"' -C metadata=b3e47eda875b4189 -C extra-filename=-b3e47eda875b4189 --out-dir /Users/printfn/Code/fend-copy/target/debug/deps -C incremental=/Users/printfn/Code/fend-copy/target/debug/incremental -L dependency=/Users/printfn/Code/fend-copy/target/debug/deps
clippy-driver(17833,0x70001050a000) malloc: *** error for object 0x60000372a200: pointer being realloc'd was not allocated
clippy-driver(17833,0x70001050a000) malloc: *** set a breakpoint in malloc_error_break to debug
zsh: abort      /Users/printfn/.rustup/toolchains/stable-x86_64-apple-darwin/bin/clippy-drive

Reproducer

I tried this code: see above

I expected to see this happen: clippy runs correctly without crashing

Instead, this happened: clippy crashed

Version

rustc 1.59.0 (9d1b2106e 2022-02-23)
binary: rustc
commit-hash: 9d1b2106e23b1abd32fce1f17267604a5102f57a
commit-date: 2022-02-23
host: x86_64-apple-darwin
release: 1.59.0
LLVM version: 13.0.0

Additional Labels

No response

@printfn printfn added the C-bug Category: Clippy is not doing the correct thing label Feb 24, 2022
@schultetwin1
Copy link

schultetwin1 commented Feb 24, 2022

I'm seeing this as well (though on a different internal code base but with the same rustc version and MacOS version). Here is a stack trace of where the abort is called from:

  * frame #0: 0x00007ff80c223112 libsystem_kernel.dylib`__pthread_kill + 10
    frame #1: 0x00007ff80c259214 libsystem_pthread.dylib`pthread_kill + 263
    frame #2: 0x00007ff80c1a5d10 libsystem_c.dylib`abort + 123
    frame #3: 0x00007ff80c0833e2 libsystem_malloc.dylib`malloc_vreport + 548
    frame #4: 0x00007ff80c0865ed libsystem_malloc.dylib`malloc_report + 151
    frame #5: 0x000000010cf38371 librustc_driver-3e12673bddf2daa8.dylib`_RNvXsp_NtCsha9agbB72OB_5alloc3vecINtB5_3VecNtNtCscdU3Y50dLLn_12rustc_expand3mbe9TokenTreeENtNtNtCsitDw8wlBh8E_4core3ops4drop4Drop4dropBJ_ + 193
    frame #6: 0x000000010cf809ea librustc_driver-3e12673bddf2daa8.dylib`_RINvNtCsitDw8wlBh8E_4core3ptr13drop_in_placeNtNtNtCscdU3Y50dLLn_12rustc_expand3mbe11macro_rules23MacroRulesMacroExpanderEBM_ + 58
    frame #7: 0x000000010bdb78b3 librustc_driver-3e12673bddf2daa8.dylib`_RNvXsi_NtCsha9agbB72OB_5alloc2rcINtB5_2RcNtNtCscdU3Y50dLLn_12rustc_expand4base15SyntaxExtensionENtNtNtCsitDw8wlBh8E_4core3ops4drop4Drop4dropCseBi0V66CXyC_13rustc_resolve + 67
    frame #8: 0x000000010be11d38 librustc_driver-3e12673bddf2daa8.dylib`_RNvMsk_CseBi0V66CXyC_13rustc_resolveNtB5_8Resolver12into_outputs + 3240
    frame #9: 0x00000001092ed806 librustc_driver-3e12673bddf2daa8.dylib`_RNvMs_NtNtCsdTXId0aadPn_15rustc_interface6passes14boxed_resolverNtB4_13BoxedResolver19to_resolver_outputs + 182
    frame #10: 0x000000010926f753 librustc_driver-3e12673bddf2daa8.dylib`_RNvMs0_NtCsdTXId0aadPn_15rustc_interface7queriesNtB5_7Queries11global_ctxt + 1251
    frame #11: 0x0000000109144cbb librustc_driver-3e12673bddf2daa8.dylib`_RINvMs2_NtCsdTXId0aadPn_15rustc_interface7queriesNtNtB8_9interface8Compiler5enterNCNCNvCs5fwt51OY56T_12rustc_driver12run_compilers_0s0_0INtNtCsitDw8wlBh8E_4core6result6ResultINtNtB2f_6option6OptionNtB6_6LinkerENtCsiafGDuwGFVC_12rustc_errors13ErrorReportedEEB1n_ + 1403
    frame #12: 0x00000001091255c7 librustc_driver-3e12673bddf2daa8.dylib`_RINvCscmk26kJ6ndw_10rustc_span15with_source_mapINtNtCsitDw8wlBh8E_4core6result6ResultuNtCsiafGDuwGFVC_12rustc_errors13ErrorReportedENCINvNtCsdTXId0aadPn_15rustc_interface9interface23create_compiler_and_runBJ_NCNvCs5fwt51OY56T_12rustc_driver12run_compilers_0Es_0EB3o_ + 359
    frame #13: 0x0000000109143205 librustc_driver-3e12673bddf2daa8.dylib`_RINvNtCsdTXId0aadPn_15rustc_interface9interface23create_compiler_and_runINtNtCsitDw8wlBh8E_4core6result6ResultuNtCsiafGDuwGFVC_12rustc_errors13ErrorReportedENCNvCs5fwt51OY56T_12rustc_driver12run_compilers_0EB2z_ + 1029
    frame #14: 0x00000001091293c9 librustc_driver-3e12673bddf2daa8.dylib`_RINvMs_CsaxEq8Xb20Ry_10scoped_tlsINtB5_9ScopedKeyNtCscmk26kJ6ndw_10rustc_span14SessionGlobalsE3setNCNCINvNtCsdTXId0aadPn_15rustc_interface4util51setup_callbacks_and_run_in_thread_pool_with_globalsNCINvNtB1H_9interface12run_compilerINtNtCsitDw8wlBh8E_4core6result6ResultuNtCsiafGDuwGFVC_12rustc_errors13ErrorReportedENCNvCs5fwt51OY56T_12rustc_driver12run_compilers_0E0B3H_E00B3H_EB58_ + 185
    frame #15: 0x00000001091275f2 librustc_driver-3e12673bddf2daa8.dylib`_RINvNtNtCs9IPV3gW9HWl_3std10sys_common9backtrace28___rust_begin_short_backtraceNCINvNtCsdTXId0aadPn_15rustc_interface4util51setup_callbacks_and_run_in_thread_pool_with_globalsNCINvNtB1m_9interface12run_compilerINtNtCsitDw8wlBh8E_4core6result6ResultuNtCsiafGDuwGFVC_12rustc_errors13ErrorReportedENCNvCs5fwt51OY56T_12rustc_driver12run_compilers_0E0B3m_E0B3m_EB4N_ + 146
    frame #16: 0x000000010917f321 librustc_driver-3e12673bddf2daa8.dylib`_RNSNvYNCINvMNtCs9IPV3gW9HWl_3std6threadNtBa_7Builder15spawn_uncheckedNCINvNtCsdTXId0aadPn_15rustc_interface4util51setup_callbacks_and_run_in_thread_pool_with_globalsNCINvNtB1c_9interface12run_compilerINtNtCsitDw8wlBh8E_4core6result6ResultuNtCsiafGDuwGFVC_12rustc_errors13ErrorReportedENCNvCs5fwt51OY56T_12rustc_driver12run_compilers_0E0B3c_E0B3c_Es_0INtNtNtB3h_3ops8function6FnOnceuE9call_once6vtableB4D_ + 177
    frame #17: 0x0000000100fe36c7 libstd-056ec5f8da85a5c6.dylib`std::sys::unix::thread::Thread::new::thread_start::hcccd55275f17da3c + 39
    frame #18: 0x00007ff80c2594f4 libsystem_pthread.dylib`_pthread_start + 125
    frame #19: 0x00007ff80c25500f libsystem_pthread.dylib`thread_start + 15

@jyn514
Copy link
Member

jyn514 commented Feb 24, 2022

_RNvXsp_NtCsha9agbB72OB_5alloc3vecINtB5_3VecNtNtCscdU3Y50dLLn_12rustc_expand3mbe9TokenTreeENtNtNtCsitDw8wlBh8E_4core3ops4drop4Drop4dropBJ_

This is in rustc_expand, before clippy ever runs - cc @petrochenkov

Strange that it only happens in clippy though.

@jyn514
Copy link
Member

jyn514 commented Feb 24, 2022

Demangled (using https://crates.io/crates/rustfilt):

  * frame #0: 0x00007ff80c223112 libsystem_kernel.dylib`__pthread_kill + 10
    frame #1: 0x00007ff80c259214 libsystem_pthread.dylib`pthread_kill + 263
    frame #2: 0x00007ff80c1a5d10 libsystem_c.dylib`abort + 123
    frame #3: 0x00007ff80c0833e2 libsystem_malloc.dylib`malloc_vreport + 548
    frame #4: 0x00007ff80c0865ed libsystem_malloc.dylib`malloc_report + 151
    frame #5: 0x000000010cf38371 librustc_driver-3e12673bddf2daa8.dylib`<alloc::vec::Vec<rustc_expand::mbe::TokenTree> as core::ops::drop::Drop>::drop + 193
    frame #6: 0x000000010cf809ea librustc_driver-3e12673bddf2daa8.dylib`core::ptr::drop_in_place::<rustc_expand::mbe::macro_rules::MacroRulesMacroExpander> + 58
    frame #7: 0x000000010bdb78b3 librustc_driver-3e12673bddf2daa8.dylib`<alloc::rc::Rc<rustc_expand::base::SyntaxExtension> as core::ops::drop::Drop>::drop + 67
    frame #8: 0x000000010be11d38 librustc_driver-3e12673bddf2daa8.dylib`<rustc_resolve::Resolver>::into_outputs + 3240
    frame #9: 0x00000001092ed806 librustc_driver-3e12673bddf2daa8.dylib`<rustc_interface::passes::boxed_resolver::BoxedResolver>::to_resolver_outputs + 182
    frame #10: 0x000000010926f753 librustc_driver-3e12673bddf2daa8.dylib`<rustc_interface::queries::Queries>::global_ctxt + 1251
    frame #11: 0x0000000109144cbb librustc_driver-3e12673bddf2daa8.dylib`<rustc_interface::interface::Compiler>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_errors::ErrorReported>> + 1403
    frame #12: 0x00000001091255c7 librustc_driver-3e12673bddf2daa8.dylib`rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_interface::interface::create_compiler_and_run<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#1}> + 359
    frame #13: 0x0000000109143205 librustc_driver-3e12673bddf2daa8.dylib`rustc_interface::interface::create_compiler_and_run::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}> + 1029
    frame #14: 0x00000001091293c9 librustc_driver-3e12673bddf2daa8.dylib`<scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>> + 185
    frame #15: 0x00000001091275f2 librustc_driver-3e12673bddf2daa8.dylib`std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>> + 146
    frame #16: 0x000000010917f321 librustc_driver-3e12673bddf2daa8.dylib`<<std::thread::Builder>::spawn_unchecked<rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 177
    frame #17: 0x0000000100fe36c7 libstd-056ec5f8da85a5c6.dylib`std::sys::unix::thread::Thread::new::thread_start::hcccd55275f17da3c + 39
    frame #18: 0x00007ff80c2594f4 libsystem_pthread.dylib`_pthread_start + 125
    frame #19: 0x00007ff80c25500f libsystem_pthread.dylib`thread_start + 15

@adamchalmers
Copy link

adamchalmers commented Feb 24, 2022

Same thing on running cargo clippy on master branch of tonic (commit a359539a22fe9920342a6f3448ee1419e3f357bd)

$ cargo clippy
    Checking serde_urlencoded v0.7.1
    Checking serde_json v1.0.79
    Checking h2 v0.3.11
   Compiling tonic-build v0.6.2 (/Users/adamchalmers/programming/tonic/tonic-build)
    Checking tower-http v0.2.3
   Compiling uuid1 v0.1.0 (/Users/adamchalmers/programming/tonic/tests/extern_path/uuid)
   Compiling tonic-types v0.4.0 (/Users/adamchalmers/programming/tonic/tonic-types)
error: could not compile `tonic-build`

Caused by:
  process didn't exit successfully: `/Users/adamchalmers/.rustup/toolchains/stable-x86_64-apple-darwin/bin/clippy-driver rustc --crate-name tonic_build --edition=2018 tonic-build/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 --cfg 'feature="compression"' --cfg 'feature="default"' --cfg 'feature="prost"' --cfg 'feature="prost-build"' --cfg 'feature="transport"' -C metadata=a7ef1ccd89939524 -C extra-filename=-a7ef1ccd89939524 --out-dir /Users/adamchalmers/programming/tonic/target/debug/deps -C incremental=/Users/adamchalmers/programming/tonic/target/debug/incremental -L dependency=/Users/adamchalmers/programming/tonic/target/debug/deps --extern prettyplease=/Users/adamchalmers/programming/tonic/target/debug/deps/libprettyplease-371f33d41a55506e.rmeta --extern proc_macro2=/Users/adamchalmers/programming/tonic/target/debug/deps/libproc_macro2-1dc4ee4d5d4212e5.rmeta --extern prost_build=/Users/adamchalmers/programming/tonic/target/debug/deps/libprost_build-9695e266ae896c0c.rmeta --extern quote=/Users/adamchalmers/programming/tonic/target/debug/deps/libquote-dcc457d31d8c4f55.rmeta --extern syn=/Users/adamchalmers/programming/tonic/target/debug/deps/libsyn-f7cdf6a5c806ff42.rmeta` (signal: 6, SIGABRT: process abort signal)
warning: build failed, waiting for other jobs to finish...
error: build failed

This does not happen on cargo build, check or doc.

Version: cargo 1.59.0 (49d8809dc 2022-02-10)
MacOS x64

@jyn514
Copy link
Member

jyn514 commented Feb 24, 2022

Can't reproduce this on tonic running on x86_64-unknown-linux-gnu. So this is probably mac-specific.

@jyn514
Copy link
Member

jyn514 commented Feb 24, 2022

Someone pointed out that frame #4: 0x00007ff80c0865ed libsystem_malloc.dylibmalloc_report + 151` is the system allocator. But rustc uses jemalloc on all platforms. So I suspect a pointer allocated by jemalloc is being freed by the system allocator.

@jyn514
Copy link
Member

jyn514 commented Feb 24, 2022

rust-lang/rust#92222 might be related, cc @nnethercote

@schultetwin1
Copy link

I tried to use cargo-bisect-rustc to debug this but I was unable to reproduce this with any nightly build starting from 2022-01-11. For each version I ran cargo clean; cargo clippy 5 times.

I also double checked, cargo +nightly clippy does not cause a crash.

@tdyas
Copy link

tdyas commented Feb 24, 2022

The crash on macOS happens with https://github.com/pantsbuild/pants as well.

@jszwedko
Copy link

Also seeing this on https://github.com/vectordotdev/vector if that helps. Similarly it fails on x86_64-apple-darwin as of 1.59.0, it works on x86_64-unknown-linux-gnu.

@tdyas
Copy link

tdyas commented Feb 25, 2022

cargo clippy on https://github.com/pantsbuild/pants does not have the error for nightly-2022-01-01 and does have the error for nightly-2022-01-02.

@nnethercote
Copy link
Contributor

cargo clippy on https://github.com/pantsbuild/pants does not have the error for nightly-2022-01-01 and does have the error for nightly-2022-01-02.

I see the same thing on fend-copy. This suggests that rust-lang/rust#92222 is probably not responsible, because it was merged on 2021-12-24, eight or nine days earlier than the regression window.

@nnethercote
Copy link
Contributor

nnethercote commented Feb 25, 2022

More testing of nightly versions on fend-copy:

2021-12-30   good

2022-01-01   good
2022-01-02   bad
2022-01-03   bad
2022-01-04   bad
2022-01-05   bad
2022-01-06   good

2022-01-08   good

2022-01-10   good

2022-01-12   good

Presumably 1.59 branched at some point during the bad four days? Where can one see what PRs merged between nightly releases?

@printfn
Copy link
Author

printfn commented Feb 25, 2022

cargo clippy on https://github.com/pantsbuild/pants does not have the error for nightly-2022-01-01 and does have the error for nightly-2022-01-02.

I see the same thing on fend-copy. This suggests that rust-lang/rust#92222 is probably not responsible, because it was merged on 2021-12-24, eight or nine days earlier than the regression window.

I'm seeing the same result as well, that it worked on 2022-01-01 and broke on 2022-01-02

@lopopolo
Copy link

lopopolo commented Feb 25, 2022

I get a slightly different stack when running this command on artichoke/artichoke's trunk branch with the toolchain upgraded to 1.59.0.

/Users/lopopolo/.rustup/toolchains/1.59.0-x86_64-apple-darwin/bin/clippy-driver rustc --crate-name mezzaluna_feature_loader --edition=2021 mezzaluna-feature-loader/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,future-incompat --crate-type lib --emit=dep-info,metadata -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 --cfg 'feature="default"' --cfg 'feature="disk"' --cfg 'feature="rubylib"' --cfg 'feature="same-file"' -C metadata=3d23aa1b2a383d90 -C extra-filename=-3d23aa1b2a383d90 --out-dir /Users/lopopolo/dev/artichoke/artichoke/target/debug/deps -C incremental=/Users/lopopolo/dev/artichoke/artichoke/target/debug/incremental -L dependency=/Users/lopopolo/dev/artichoke/artichoke/target/debug/deps --extern same_file=/Users/lopopolo/dev/artichoke/artichoke/target/debug/deps/libsame_file-6b90921f826f6559.rmeta
* thread #2, name = 'rustc', stop reason = signal SIGABRT
  * frame #0: 0x00007ff810303112 libsystem_kernel.dylib`__pthread_kill + 10
    frame #1: 0x00007ff810339214 libsystem_pthread.dylib`pthread_kill + 263
    frame #2: 0x00007ff810285d10 libsystem_c.dylib`abort + 123
    frame #3: 0x00007ff8101633e2 libsystem_malloc.dylib`malloc_vreport + 548
    frame #4: 0x00007ff8101665ed libsystem_malloc.dylib`malloc_report + 151
    frame #5: 0x00007ff810157542 libsystem_malloc.dylib`realloc + 328
    frame #6: 0x000000010cf540e4 librustc_driver-3e12673bddf2daa8.dylib`_RINvNtCsha9agbB72OB_5alloc7raw_vec11finish_growNtNtB4_5alloc6GlobalECscdU3Y50dLLn_12rustc_expand + 52
    frame #7: 0x000000010cf53a93 librustc_driver-3e12673bddf2daa8.dylib`_RNvMs_NtCsha9agbB72OB_5alloc7raw_vecINtB4_6RawVecNtNtCscdU3Y50dLLn_12rustc_expand3mbe9TokenTreeE16reserve_for_pushBP_ + 131
    frame #8: 0x000000010cecdcc2 librustc_driver-3e12673bddf2daa8.dylib`_RNvNtNtCscdU3Y50dLLn_12rustc_expand3mbe6quoted5parse + 3954
    frame #9: 0x000000010ceccebb librustc_driver-3e12673bddf2daa8.dylib`_RNvNtNtCscdU3Y50dLLn_12rustc_expand3mbe6quoted5parse + 363
    frame #10: 0x000000010ceebffb librustc_driver-3e12673bddf2daa8.dylib`_RINvXs0_NtNtNtCsitDw8wlBh8E_4core4iter8adapters3mapINtB6_3MapINtNtNtBc_5slice4iter4IterNtNtNtCscdU3Y50dLLn_12rustc_expand3mbe12macro_parser10NamedMatchENCNvNtB1r_11macro_rules25compile_declarative_macros0_0ENtNtNtBa_6traits8iterator8Iterator4folduNCINvNvB3j_8for_each4callNtB1r_9TokenTreeNCNvXs_NtNtCsha9agbB72OB_5alloc3vec11spec_extendINtB4L_3VecB4m_EINtB4J_10SpecExtendB4m_BN_E11spec_extend0E0EB1t_ + 347
    frame #11: 0x000000010cf2ea98 librustc_driver-3e12673bddf2daa8.dylib`_RNvXNtNtCsha9agbB72OB_5alloc3vec14spec_from_iterINtB4_3VecNtNtCscdU3Y50dLLn_12rustc_expand3mbe9TokenTreeEINtB2_12SpecFromIterBU_INtNtNtNtCsitDw8wlBh8E_4core4iter8adapters3map3MapINtNtNtB2b_5slice4iter4IterNtNtBW_12macro_parser10NamedMatchENCNvNtBW_11macro_rules25compile_declarative_macros0_0EE9from_iterBY_ + 200
    frame #12: 0x000000010cf8490c librustc_driver-3e12673bddf2daa8.dylib`_RNvNtNtCscdU3Y50dLLn_12rustc_expand3mbe11macro_rules25compile_declarative_macro + 2876
    frame #13: 0x000000010be0b9d6 librustc_driver-3e12673bddf2daa8.dylib`_RNvMs_NtCseBi0V66CXyC_13rustc_resolve6macrosNtB6_8Resolver13compile_macro + 70
    frame #14: 0x000000010bdee40b librustc_driver-3e12673bddf2daa8.dylib`_RNvMs1_NtCseBi0V66CXyC_13rustc_resolve19build_reduced_graphNtB7_8Resolver19get_macro_by_def_id + 395
    frame #15: 0x000000010be04934 librustc_driver-3e12673bddf2daa8.dylib`_RNvMs_NtCseBi0V66CXyC_13rustc_resolve6macrosNtB6_8Resolver18resolve_macro_path + 2532
    frame #16: 0x000000010be0168c librustc_driver-3e12673bddf2daa8.dylib`_RNvXNtCseBi0V66CXyC_13rustc_resolve6macrosNtB4_8ResolverNtNtCscdU3Y50dLLn_12rustc_expand4base14ResolverExpand24resolve_macro_invocation + 1388
    frame #17: 0x000000010ceb4c48 librustc_driver-3e12673bddf2daa8.dylib`_RNvMs1_NtCscdU3Y50dLLn_12rustc_expand6expandNtB5_13MacroExpander21fully_expand_fragment + 1576
    frame #18: 0x000000010ceb436e librustc_driver-3e12673bddf2daa8.dylib`_RNvMs1_NtCscdU3Y50dLLn_12rustc_expand6expandNtB5_13MacroExpander12expand_crate + 1166
    frame #19: 0x0000000109301a14 librustc_driver-3e12673bddf2daa8.dylib`_RINvMNtCsh5cXrCW77aF_13rustc_session5utilsNtNtB5_7session7Session4timeINtNtCsitDw8wlBh8E_4core6result6ResultNtNtCshAo0c1qMDhP_9rustc_ast3ast5CrateNtCsiafGDuwGFVC_12rustc_errors13ErrorReportedENCNvNtCsdTXId0aadPn_15rustc_interface6passes20configure_and_expands_0EB3a_ + 1012
    frame #20: 0x0000000109265f03 librustc_driver-3e12673bddf2daa8.dylib`_RNvNtCsdTXId0aadPn_15rustc_interface6passes20configure_and_expand + 563
    frame #21: 0x000000010926be23 librustc_driver-3e12673bddf2daa8.dylib`_RNvMs0_NtCsdTXId0aadPn_15rustc_interface7queriesNtB5_7Queries9expansion + 835
    frame #22: 0x0000000109144c20 librustc_driver-3e12673bddf2daa8.dylib`_RINvMs2_NtCsdTXId0aadPn_15rustc_interface7queriesNtNtB8_9interface8Compiler5enterNCNCNvCs5fwt51OY56T_12rustc_driver12run_compilers_0s0_0INtNtCsitDw8wlBh8E_4core6result6ResultINtNtB2f_6option6OptionNtB6_6LinkerENtCsiafGDuwGFVC_12rustc_errors13ErrorReportedEEB1n_ + 1248
    frame #23: 0x00000001091255c7 librustc_driver-3e12673bddf2daa8.dylib`_RINvCscmk26kJ6ndw_10rustc_span15with_source_mapINtNtCsitDw8wlBh8E_4core6result6ResultuNtCsiafGDuwGFVC_12rustc_errors13ErrorReportedENCINvNtCsdTXId0aadPn_15rustc_interface9interface23create_compiler_and_runBJ_NCNvCs5fwt51OY56T_12rustc_driver12run_compilers_0Es_0EB3o_ + 359
    frame #24: 0x0000000109143205 librustc_driver-3e12673bddf2daa8.dylib`_RINvNtCsdTXId0aadPn_15rustc_interface9interface23create_compiler_and_runINtNtCsitDw8wlBh8E_4core6result6ResultuNtCsiafGDuwGFVC_12rustc_errors13ErrorReportedENCNvCs5fwt51OY56T_12rustc_driver12run_compilers_0EB2z_ + 1029
    frame #25: 0x00000001091293c9 librustc_driver-3e12673bddf2daa8.dylib`_RINvMs_CsaxEq8Xb20Ry_10scoped_tlsINtB5_9ScopedKeyNtCscmk26kJ6ndw_10rustc_span14SessionGlobalsE3setNCNCINvNtCsdTXId0aadPn_15rustc_interface4util51setup_callbacks_and_run_in_thread_pool_with_globalsNCINvNtB1H_9interface12run_compilerINtNtCsitDw8wlBh8E_4core6result6ResultuNtCsiafGDuwGFVC_12rustc_errors13ErrorReportedENCNvCs5fwt51OY56T_12rustc_driver12run_compilers_0E0B3H_E00B3H_EB58_ + 185
    frame #26: 0x00000001091275f2 librustc_driver-3e12673bddf2daa8.dylib`_RINvNtNtCs9IPV3gW9HWl_3std10sys_common9backtrace28___rust_begin_short_backtraceNCINvNtCsdTXId0aadPn_15rustc_interface4util51setup_callbacks_and_run_in_thread_pool_with_globalsNCINvNtB1m_9interface12run_compilerINtNtCsitDw8wlBh8E_4core6result6ResultuNtCsiafGDuwGFVC_12rustc_errors13ErrorReportedENCNvCs5fwt51OY56T_12rustc_driver12run_compilers_0E0B3m_E0B3m_EB4N_ + 146
    frame #27: 0x000000010917f321 librustc_driver-3e12673bddf2daa8.dylib`_RNSNvYNCINvMNtCs9IPV3gW9HWl_3std6threadNtBa_7Builder15spawn_uncheckedNCINvNtCsdTXId0aadPn_15rustc_interface4util51setup_callbacks_and_run_in_thread_pool_with_globalsNCINvNtB1c_9interface12run_compilerINtNtCsitDw8wlBh8E_4core6result6ResultuNtCsiafGDuwGFVC_12rustc_errors13ErrorReportedENCNvCs5fwt51OY56T_12rustc_driver12run_compilers_0E0B3c_E0B3c_Es_0INtNtNtB3h_3ops8function6FnOnceuE9call_once6vtableB4D_ + 177
    frame #28: 0x0000000100fe36c7 libstd-056ec5f8da85a5c6.dylib`std::sys::unix::thread::Thread::new::thread_start::hcccd55275f17da3c + 39
    frame #29: 0x00007ff8103394f4 libsystem_pthread.dylib`_pthread_start + 125
    frame #30: 0x00007ff81033500f libsystem_pthread.dylib`thread_start + 15

@lopopolo
Copy link

lopopolo commented Feb 25, 2022

out of curiosity, would fixing this bug in clippy warrant a point release on the 1.59 toolchain?

@dnaka91
Copy link

dnaka91 commented Feb 25, 2022

Same problem here. Getting this error on about 50% of my projects. Seems to be especially happening when an async runtime is part of the dependencies 🤔.

Getting the same as the issue creator with fend too:

clippy-driver(63703,0x70000e9a5000) malloc: *** error for object 0x6000012a7e00: pointer being realloc'd was not allocated
clippy-driver(63703,0x70000e9a5000) malloc: *** set a breakpoint in malloc_error_break to debug

Edit: Added my clippy, cargo and rustc info.

clippy 0.1.59 (9d1b2106 2022-02-23)
cargo 1.59.0 (49d8809dc 2022-02-10)
release: 1.59.0
commit-hash: 49d8809dc2d3e6e0d5ec634fcf26d8e2aab67130
commit-date: 2022-02-10
host: x86_64-apple-darwin
libgit2: 1.3.0 (sys:0.13.23 vendored)
libcurl: 7.77.0 (sys:0.4.51+curl-7.80.0 system ssl:(SecureTransport) LibreSSL/2.8.3)
os: Mac OS 12.2.1 [64-bit]
rustc 1.59.0 (9d1b2106e 2022-02-23)
binary: rustc
commit-hash: 9d1b2106e23b1abd32fce1f17267604a5102f57a
commit-date: 2022-02-23
host: x86_64-apple-darwin
release: 1.59.0
LLVM version: 13.0.0

@gabrik
Copy link

gabrik commented Feb 25, 2022

Same problem here, getting it when running cargo clippy --all-targets -- -D warnings on my pre-commit hook for https://github.com/eclipse-zenoh/zenoh-flow

The CI works like a charm so it really seems macOS related.

clippy 0.1.59 (9d1b2106 2022-02-23)
macOS 12.1
x86_64 Mac

rustc 1.59.0 (9d1b2106e 2022-02-23)
binary: rustc
commit-hash: 9d1b2106e23b1abd32fce1f17267604a5102f57a
commit-date: 2022-02-23
host: x86_64-apple-darwin
release: 1.59.0
LLVM version: 13.0.0

It seems to work fine on arm-based Macs, as far as my colleagues tested.

@extrawurst
Copy link

have the issue on https://github.com/extrawurst/gitui swell when just running cargo clippy:

Caused by:
  process didn't exit successfully: `/Users/stephan/.rustup/toolchains/stable-x86_64-apple-darwin/bin/clippy-driver rustc --crate-name asyncgit --edition=2018 asyncgit/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,future-incompat --crate-type lib --emit=dep-info,metadata -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 --cfg 'feature="trace-libgit"' -C metadata=db8455c39f529c59 -C extra-filename=-db8455c39f529c59 --out-dir /Users/stephan/code/gitui/target/debug/deps -C incremental=/Users/stephan/code/gitui/target/debug/incremental -L dependency=/Users/stephan/code/gitui/target/debug/deps --extern crossbeam_channel=/Users/stephan/code/gitui/target/debug/deps/libcrossbeam_channel-6556435dc0899d09.rmeta --extern easy_cast=/Users/stephan/code/gitui/target/debug/deps/libeasy_cast-74ded4c21027376b.rmeta --extern git2=/Users/stephan/code/gitui/target/debug/deps/libgit2-ed5d34393585cdeb.rmeta --extern log=/Users/stephan/code/gitui/target/debug/deps/liblog-0bac11633759f45e.rmeta --extern openssl_sys=/Users/stephan/code/gitui/target/debug/deps/libopenssl_sys-f2cfe67eb1b653ec.rmeta --extern rayon_core=/Users/stephan/code/gitui/target/debug/deps/librayon_core-36e39b5ea63c2f59.rmeta --extern scopetime=/Users/stephan/code/gitui/target/debug/deps/libscopetime-577bb5c35f28ecc0.rmeta --extern shellexpand=/Users/stephan/code/gitui/target/debug/deps/libshellexpand-53df33d5758de930.rmeta --extern thiserror=/Users/stephan/code/gitui/target/debug/deps/libthiserror-f12980cb9bd87f09.rmeta --extern unicode_truncate=/Users/stephan/code/gitui/target/debug/deps/libunicode_truncate-5c51ff90de70259e.rmeta --extern url=/Users/stephan/code/gitui/target/debug/deps/liburl-83c536ffb60af2b6.rmeta -L native=/Users/stephan/code/gitui/target/debug/build/libgit2-sys-72b2ac2481dc9b56/out/build -L native=/Users/stephan/code/gitui/target/debug/build/libssh2-sys-e44e7be77edee2ba/out/build -L native=/Users/stephan/code/gitui/target/debug/build/openssl-sys-ee68dcbca948f2c4/out/openssl-build/install/lib` (signal: 6, SIGABRT: process abort signal)

@ehuss
Copy link
Contributor

ehuss commented Feb 26, 2022

Someone pinged this over on rust-lang/rust. This is related to rust-lang/rust#92173 and rust-lang/rust#92185. Clippy is not built with jemalloc, which is surface problem. I wasn't able to determine the underlying problem, though.

@xFrednet xFrednet added the I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️ label Feb 26, 2022
lopopolo added a commit to artichoke/artichoke that referenced this issue Mar 4, 2022
`cstr` 0.2.10 reworks the proc macro to use `CStr::from_bytes_with_nul_unchecked`
which was just recently made const in Rust 1.59.0.

See:

- https://doc.rust-lang.org/stable/std/ffi/struct.CStr.html#method.from_bytes_with_nul_unchecked
- upsuper/cstr@8357a00

`artichoke-backend` uses `cstr` in const contexts but cannot upgrade to
Rust 1.59.0 due to rust-lang/rust-clippy#8470.

Change the `cstr` version constraint to `cstr = "0.2.4, < 0.2.10" until
Artichoke can upgrade its Rust toolchain to unblock March's `cargo update`.
@rdornin
Copy link

rdornin commented Mar 18, 2022

I just want to report that issue is currently blocking me in development. If there are any work around for the macos darwin tool chain and clippy errors... would love to hear about it.

@dbanty
Copy link

dbanty commented Mar 19, 2022

I just want to report that issue is currently blocking me in development. If there are any work around for the macos darwin tool chain and clippy errors... would love to hear about it.

For right now my workaround has been to use rustup default 1.58 on macOS. This pins you to the latest before 1.59, so you don't get the features of 1.59 but at least you can keep working for now! And I'm subscribed to this issue so I'll know when it's safe to unpin 😄

@syphar
Copy link
Member

syphar commented Mar 20, 2022

short update for the ones that only watch this issue:

Analysis we've done so far: it seems that something is broken with the macOS 12-provided /usr/lib/libstdc++.6.dylib. Swapping to the homebrew-provided libstdc++ seems to fix the crash, and using link-cplusplus to swap to libc++ also seems to fix the crash. Switching to jemalloc or mimalloc seemed to fix this.

I've been tracking this issue. My fix was to downgrade to my project's MSRV, 1.57. But after the latest "Command Line Tools for Xcode" update (13.3), I found that I could run clippy again on both stable-x86_64-apple-darwin and stable-aarch64-apple-darwin. I haven't found anything in the changelog that is directly related to this, but it fixed the problem for me, and I think this could be of use.

( from rust-lang/rust#92173 , this comment, by @7596ff )

The update worked for me too.

@extrawurst
Copy link

Thank you @syphar !!! That fixed it for me too🥳

@scouten-adobe
Copy link

scouten-adobe commented Mar 29, 2022

FWIW I am still seeing cargo clippy crash reliably after applying the Xcode 13.3 and corresponding command-line tools updates. This is a closed-source project; not sure where to start looking for a repro case that I can share.

We are fine staying on 1.58.1; this is not a blocker for us. 🤞 for a fix in 1.60.0.

Confirmed fixed in 1.60.0.

@anacrolix
Copy link

I installed Xcode 13.3 and I still have the problem. Is there something required, like a rebuild of clippy?

@maedox
Copy link

maedox commented Apr 7, 2022

1.60 fixed it for me.

@scouten-adobe
Copy link

1.60.0 fixed my problem also. Thank you!

@printfn
Copy link
Author

printfn commented Apr 7, 2022

It's fixed for me as well, so I'll go ahead and close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests