Skip to content

panic w/ clippy 0.1.63 (4b91a6ea 2022-08-08) #9358

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

Closed
joshuef opened this issue Aug 21, 2022 · 6 comments
Closed

panic w/ clippy 0.1.63 (4b91a6ea 2022-08-08) #9358

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

Comments

@joshuef
Copy link

joshuef commented Aug 21, 2022

Running clipy against my Wip branch (excuse the mess! :P ): here's the specific commit

This is on my m1 air. Let me know if more details are needed!

(And thanks for all the clippy work so far! 🙇 )

    Checking sn_cli v0.60.0 (/Users/josh/Projects/sn/sn_cli)
thread 'rustc' panicked at 'attempted to read from stolen value: rustc_middle::mir::Body', compiler/rustc_mir_transform/src/check_unsafety.rs:517:36
stack backtrace:
   0:        0x101d3bfe0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h188b7ef1c7993e78
   1:        0x101d8da54 - core::fmt::write::he84a3004e7af3f34
   2:        0x101d2f0c0 - std::io::Write::write_fmt::h9370b50affaab0be
   3:        0x101d3ec24 - std::panicking::default_hook::{{closure}}::hc074f8023cce83ca
   4:        0x101d3e98c - std::panicking::default_hook::hef854b51b9b79ff2
   5:        0x100c8d400 - clippy_driver[8db44a2b9e9d2669]::ICE_HOOK::{closure#0}::{closure#0}
   6:        0x101d3f1f8 - std::panicking::rust_panic_with_hook::h1e59e224d558a492
   7:        0x101d3f090 - std::panicking::begin_panic_handler::{{closure}}::he1a9d6ab32bfd8c6
   8:        0x101d3c4bc - std::sys_common::backtrace::__rust_end_short_backtrace::he9b94791b02f48cd
   9:        0x101d3ede8 - _rust_begin_unwind
  10:        0x101dbb968 - core::panicking::panic_fmt::h9fec86f6a9c4146e
  11:        0x10b3ad09c - <rustc_data_structures[d06618763e7f5cde]::steal::Steal<rustc_middle[4fa9dd76776bb2aa]::mir::Body>>::borrow
  12:        0x10b441618 - rustc_mir_transform[3d5b9cf55a33f4c9]::check_unsafety::unsafety_check_result
  13:        0x10b43d8e4 - <rustc_mir_transform[3d5b9cf55a33f4c9]::check_unsafety::provide::{closure#0} as core[bae5e8ef542d20e5]::ops::function::FnOnce<(rustc_middle[4fa9dd76776bb2aa]::ty::context::TyCtxt, rustc_span[143ffa354e326ede]::def_id::LocalDefId)>>::call_once
  14:        0x10bfccdf4 - rustc_query_system[f18d9eae22d44560]::query::plumbing::try_load_from_disk_and_cache_in_memory::<rustc_query_impl[d9716e6ec5023784]::plumbing::QueryCtxt, rustc_span[143ffa354e326ede]::def_id::LocalDefId, &rustc_middle[4fa9dd76776bb2aa]::mir::query::UnsafetyCheckResult>
  15:        0x10bf67960 - rustc_query_system[f18d9eae22d44560]::query::plumbing::try_execute_query::<rustc_query_impl[d9716e6ec5023784]::plumbing::QueryCtxt, rustc_query_system[f18d9eae22d44560]::query::caches::DefaultCache<rustc_span[143ffa354e326ede]::def_id::LocalDefId, &rustc_middle[4fa9dd76776bb2aa]::mir::query::UnsafetyCheckResult>>
  16:        0x10c015a8c - rustc_query_system[f18d9eae22d44560]::query::plumbing::get_query::<rustc_query_impl[d9716e6ec5023784]::queries::unsafety_check_result, rustc_query_impl[d9716e6ec5023784]::plumbing::QueryCtxt>
  17:        0x10b441ffc - rustc_mir_transform[3d5b9cf55a33f4c9]::check_unsafety::check_unsafety
  18:        0x109247258 - <rustc_session[282d64e95cd3bf88]::session::Session>::time::<(), rustc_interface[db32075e2a9c594e]::passes::analysis::{closure#3}>
  19:        0x109237f74 - rustc_interface[db32075e2a9c594e]::passes::analysis
  20:        0x10c1c7b48 - <rustc_query_system[f18d9eae22d44560]::dep_graph::graph::DepGraph<rustc_middle[4fa9dd76776bb2aa]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[4fa9dd76776bb2aa]::ty::context::TyCtxt, (), core[bae5e8ef542d20e5]::result::Result<(), rustc_errors[3321b68084f70bb0]::ErrorGuaranteed>>
  21:        0x10bf9c5d0 - rustc_query_system[f18d9eae22d44560]::query::plumbing::try_execute_query::<rustc_query_impl[d9716e6ec5023784]::plumbing::QueryCtxt, rustc_query_system[f18d9eae22d44560]::query::caches::DefaultCache<(), core[bae5e8ef542d20e5]::result::Result<(), rustc_errors[3321b68084f70bb0]::ErrorGuaranteed>>>
  22:        0x10c03b54c - rustc_query_system[f18d9eae22d44560]::query::plumbing::get_query::<rustc_query_impl[d9716e6ec5023784]::queries::analysis, rustc_query_impl[d9716e6ec5023784]::plumbing::QueryCtxt>
  23:        0x10916e66c - <rustc_interface[db32075e2a9c594e]::passes::QueryContext>::enter::<rustc_driver[8d2050f8429f7bc4]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[bae5e8ef542d20e5]::result::Result<(), rustc_errors[3321b68084f70bb0]::ErrorGuaranteed>>
  24:        0x1091517f0 - <rustc_interface[db32075e2a9c594e]::interface::Compiler>::enter::<rustc_driver[8d2050f8429f7bc4]::run_compiler::{closure#1}::{closure#2}, core[bae5e8ef542d20e5]::result::Result<core[bae5e8ef542d20e5]::option::Option<rustc_interface[db32075e2a9c594e]::queries::Linker>, rustc_errors[3321b68084f70bb0]::ErrorGuaranteed>>
  25:        0x10913dbb4 - rustc_span[143ffa354e326ede]::with_source_map::<core[bae5e8ef542d20e5]::result::Result<(), rustc_errors[3321b68084f70bb0]::ErrorGuaranteed>, rustc_interface[db32075e2a9c594e]::interface::create_compiler_and_run<core[bae5e8ef542d20e5]::result::Result<(), rustc_errors[3321b68084f70bb0]::ErrorGuaranteed>, rustc_driver[8d2050f8429f7bc4]::run_compiler::{closure#1}>::{closure#1}>
  26:        0x109151fe8 - <scoped_tls[e8c526b3ddc66487]::ScopedKey<rustc_span[143ffa354e326ede]::SessionGlobals>>::set::<rustc_interface[db32075e2a9c594e]::interface::run_compiler<core[bae5e8ef542d20e5]::result::Result<(), rustc_errors[3321b68084f70bb0]::ErrorGuaranteed>, rustc_driver[8d2050f8429f7bc4]::run_compiler::{closure#1}>::{closure#0}, core[bae5e8ef542d20e5]::result::Result<(), rustc_errors[3321b68084f70bb0]::ErrorGuaranteed>>
  27:        0x10919cb68 - std[ad4c17a2ddbcabe2]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[db32075e2a9c594e]::util::run_in_thread_pool_with_globals<rustc_interface[db32075e2a9c594e]::interface::run_compiler<core[bae5e8ef542d20e5]::result::Result<(), rustc_errors[3321b68084f70bb0]::ErrorGuaranteed>, rustc_driver[8d2050f8429f7bc4]::run_compiler::{closure#1}>::{closure#0}, core[bae5e8ef542d20e5]::result::Result<(), rustc_errors[3321b68084f70bb0]::ErrorGuaranteed>>::{closure#0}, core[bae5e8ef542d20e5]::result::Result<(), rustc_errors[3321b68084f70bb0]::ErrorGuaranteed>>
  28:        0x109170ef8 - <<std[ad4c17a2ddbcabe2]::thread::Builder>::spawn_unchecked_<rustc_interface[db32075e2a9c594e]::util::run_in_thread_pool_with_globals<rustc_interface[db32075e2a9c594e]::interface::run_compiler<core[bae5e8ef542d20e5]::result::Result<(), rustc_errors[3321b68084f70bb0]::ErrorGuaranteed>, rustc_driver[8d2050f8429f7bc4]::run_compiler::{closure#1}>::{closure#0}, core[bae5e8ef542d20e5]::result::Result<(), rustc_errors[3321b68084f70bb0]::ErrorGuaranteed>>::{closure#0}, core[bae5e8ef542d20e5]::result::Result<(), rustc_errors[3321b68084f70bb0]::ErrorGuaranteed>>::{closure#1} as core[bae5e8ef542d20e5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  29:        0x101d47a5c - std::sys::unix::thread::Thread::new::thread_start::h7b2f9b83fb320a20
  30:        0x1915a826c - __pthread_deallocate

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.1.63 (4b91a6ea 2022-08-08)

query stack during panic:
#0 [unsafety_check_result] unsafety-checking `cli::run`
#1 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `sn_cli`
@xFrednet
Copy link
Member

Hey, thank you for the report. The error seems to originate from rustc, but it could be that clippy influences this somehow. We had an issue like that recently.

Could you try our the latest nightly to see if it still happens? And does cargo check also Panik?

@xFrednet xFrednet added C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️ labels Aug 21, 2022
@joshuef
Copy link
Author

joshuef commented Aug 21, 2022

cargo check is fine.

How does one use clippy nightly? Just use rust nightly or is there more to it

@lukaslueg
Copy link
Contributor

@joshuef cargo +nightly clippy or cargo +nightly check after you rustup update nightly

@giraffate
Copy link
Contributor

It seems to be a duplicate of rust-lang/rust#91015.

@joshuef
Copy link
Author

joshuef commented Aug 22, 2022

Okay, nightly does not panic 🎉

I get the error out

error: unnecessary closure used with `bool::then`
   --> testnet/bin.rs:150:21
    |
150 | /                     result
151 | |                         .status
152 | |                         .success()
153 | |                         .then(|| ())
    | |__________________________----------^
    |                            |
    |                            help: use `then_some(..)` instead: `then_some(())`
    |
    = note: `-D clippy::unnecessary-lazy-evaluations` implied by `-D warnings`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations

@dswij
Copy link
Member

dswij commented Aug 28, 2022

Thanks for the report. Will be closing this since it seems to be resolved in nightly.

@dswij dswij closed this as completed Aug 28, 2022
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

5 participants