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

ICE in GeneratorSubsts / clippy #5207

Closed
hirrolot opened this issue Feb 20, 2020 · 11 comments · Fixed by #5213
Closed

ICE in GeneratorSubsts / clippy #5207

hirrolot opened this issue Feb 20, 2020 · 11 comments · Fixed by #5213
Assignees

Comments

@hirrolot
Copy link

Show the backtrace
$ RUST_BACKTRACE=full cargo clippy --all-targets --all-features -- -D warnings
    Checking teloxide v0.1.0 (/media/hirrolot/772CF8924BEBB279/Documents/teloxide)
error: internal compiler error: src/librustc/ty/subst.rs:328: expected type for param #0 in [ReErased, UListener, ListenerE, Eh, (), (), (), for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7, 't8> {&'r dispatching::dispatcher::Dispatcher, UListener, std::sync::Arc<Eh>, std::pin::Pin<std::boxed::Box<UListener>>, [closure@src/dispatching/dispatcher.rs:232:23: 340:14 update_listener_error_handler:std::sync::Arc<Eh>, self:&'t2 dispatching::dispatcher::Dispatcher], futures_util::stream::stream::for_each::ForEach<std::pin::Pin<std::boxed::Box<UListener>>, impl core::future::future::Future, [closure@src/dispatching/dispatcher.rs:232:23: 340:14 update_listener_error_handler:std::sync::Arc<Eh>, self:&'t8 dispatching::dispatcher::Dispatcher]>, ()}, &dispatching::dispatcher::Dispatcher, UListener, std::sync::Arc<Eh>]

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:881:9
stack backtrace:
   0:     0x7fe3597e0634 - backtrace::backtrace::libunwind::trace::h0743ecf0c905ca1e
                               at /cargo/registry/src/git.luolix.top-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/libunwind.rs:86
   1:     0x7fe3597e0634 - backtrace::backtrace::trace_unsynchronized::h0e046f0811b0ae4d
                               at /cargo/registry/src/git.luolix.top-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/mod.rs:66
   2:     0x7fe3597e0634 - std::sys_common::backtrace::_print_fmt::h5fcd1fd3d0e5d79e
                               at src/libstd/sys_common/backtrace.rs:78
   3:     0x7fe3597e0634 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h85ffb53d56efd098
                               at src/libstd/sys_common/backtrace.rs:59
   4:     0x7fe3598197dc - core::fmt::write::h231e5515e704e96b
                               at src/libcore/fmt/mod.rs:1052
   5:     0x7fe3597d1f97 - std::io::Write::write_fmt::h56f503f924d6c255
                               at src/libstd/io/mod.rs:1428
   6:     0x7fe3597e5425 - std::sys_common::backtrace::_print::hf64c641be26866a9
                               at src/libstd/sys_common/backtrace.rs:62
   7:     0x7fe3597e5425 - std::sys_common::backtrace::print::h16b5d561563c7498
                               at src/libstd/sys_common/backtrace.rs:49
   8:     0x7fe3597e5425 - std::panicking::default_hook::{{closure}}::h8363003bce1deb1a
                               at src/libstd/panicking.rs:204
   9:     0x7fe3597e5166 - std::panicking::default_hook::hb365b24076d7b200
                               at src/libstd/panicking.rs:224
  10:     0x5616108a98e1 - clippy_driver::report_clippy_ice::h2428d4b5b8cdf1d1
  11:     0x7fe349fa4f46 - <alloc::boxed::Box<F> as core::ops::function::Fn<A>>::call::hd9ae7b0761284e9a
                               at /rustc/7760cd0fbbbf2c59a625e075a5bdfa88b8e30f8a/src/liballoc/boxed.rs:1031
  12:     0x7fe34a006565 - proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter::{{closure}}::{{closure}}::hed10b9edeba6f8fd
                               at /rustc/7760cd0fbbbf2c59a625e075a5bdfa88b8e30f8a/src/libproc_macro/bridge/client.rs:305
  13:     0x7fe3597e5b55 - std::panicking::rust_panic_with_hook::h2adc1d4c38cb25af
                               at src/libstd/panicking.rs:474
  14:     0x7fe35c4d7423 - std::panicking::begin_panic::h0aec239d5556eaef
  15:     0x7fe35c5138c0 - rustc_errors::HandlerInner::bug::h5a56033e2c1b87b4
  16:     0x7fe35c512730 - rustc_errors::Handler::bug::h1b810e82d2accdfd
  17:     0x7fe35beab9b9 - rustc::util::bug::opt_span_bug_fmt::{{closure}}::hfb5ce951ff65a963
  18:     0x7fe35bea99bb - rustc::ty::context::tls::with_opt::{{closure}}::hcd7506f2e186e18f
  19:     0x7fe35bea9962 - rustc::ty::context::tls::with_opt::h0cd5a436ee51bd5a
  20:     0x7fe35beab8c8 - rustc::util::bug::opt_span_bug_fmt::hdfd9d9d632e96cbf
  21:     0x7fe35beab832 - rustc::util::bug::bug_fmt::h4f9e83e5dd7730a3
  22:     0x7fe35bd35732 - rustc::ty::sty::GeneratorSubsts::split::h1e16dd9b25626ede
  23:     0x7fe35bd35819 - rustc::ty::sty::GeneratorSubsts::return_ty::hdd748e6cab3f103c
  24:     0x5616109d1e7c - clippy_lints::doc::lint_for_missing_headers::h2d7b93f4ac3ebea5
  25:     0x5616109d1c2f - <clippy_lints::doc::DocMarkdown as rustc_lint::passes::LateLintPass>::check_impl_item::h82346d4aeb04375b
  26:     0x7fe35b967763 - <rustc_lint::late::LateLintPassObjects as rustc_lint::passes::LateLintPass>::check_impl_item::h2b231c4813970416
  27:     0x7fe35a09fd6f - rustc_hir::intravisit::Visitor::visit_nested_impl_item::hae814d331940772b
  28:     0x7fe35a020c10 - rustc_hir::intravisit::walk_item::h0adbbed49deb2651
  29:     0x7fe35a09f490 - rustc_hir::intravisit::Visitor::visit_nested_item::h1e86d900227c1722
  30:     0x7fe35a0202ae - rustc_hir::intravisit::walk_item::h0adbbed49deb2651
  31:     0x7fe35a09f490 - rustc_hir::intravisit::Visitor::visit_nested_item::h1e86d900227c1722
  32:     0x7fe35a0202ae - rustc_hir::intravisit::walk_item::h0adbbed49deb2651
  33:     0x7fe35a09f490 - rustc_hir::intravisit::Visitor::visit_nested_item::h1e86d900227c1722
  34:     0x7fe35a01a4ae - rustc_hir::intravisit::walk_crate::h5ac97776a2ed6dbd
  35:     0x7fe35a08763d - rustc_lint::late::late_lint_pass_crate::hd644954c32b8090d
  36:     0x7fe35a086e5b - rustc_lint::late::late_lint_crate::h0c6f02b17ef245d9
  37:     0x7fe35a03a87b - rustc_data_structures::sync::join::hbad259b40b9162d1
  38:     0x7fe35a033147 - <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h18f82cd9d16f697d
  39:     0x7fe3597f7447 - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:86
  40:     0x7fe35a033a33 - <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h6023b78bf5f52a70
  41:     0x7fe3597f7447 - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:86
  42:     0x7fe35a03779a - rustc_session::utils::<impl rustc_session::session::Session>::time::h81fbc1aceb153fa3
  43:     0x7fe35a0e27bb - rustc_interface::passes::analysis::h93c51a787db93e0e
  44:     0x7fe359e77b06 - rustc::ty::query::__query_compute::analysis::h2e65031e80457914
  45:     0x7fe359ed756c - rustc::dep_graph::graph::DepGraph::with_task_impl::h5f55e528bf751214
  46:     0x7fe359e57890 - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query::h64428c911596e370
  47:     0x7fe359e5a87e - rustc::ty::context::tls::enter_global::hfade6d9b67bf1644
  48:     0x7fe359eb91ac - rustc_interface::interface::run_compiler_in_existing_thread_pool::hdde65f8eb6e34231
  49:     0x7fe359e7329d - scoped_tls::ScopedKey<T>::set::h774e12e87074d2a2
  50:     0x7fe359e5ad82 - syntax::attr::with_globals::hd6f4e6fb8aaadb66
  51:     0x7fe359e74963 - std::sys_common::backtrace::__rust_begin_short_backtrace::h2e517a7b74830ac8
  52:     0x7fe3597f7447 - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:86
  53:     0x7fe359ebaef6 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h3814fa1c62419cc0
  54:     0x7fe3597c231f - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h8e917a822ffc0592
                               at /rustc/7760cd0fbbbf2c59a625e075a5bdfa88b8e30f8a/src/liballoc/boxed.rs:1017
  55:     0x7fe3597f5d50 - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h8aa486ee72f31ff1
                               at /rustc/7760cd0fbbbf2c59a625e075a5bdfa88b8e30f8a/src/liballoc/boxed.rs:1017
  56:     0x7fe3597f5d50 - std::sys_common::thread::start_thread::h8407e13fad90fc7e
                               at src/libstd/sys_common/thread.rs:13
  57:     0x7fe3597f5d50 - std::sys::unix::thread::Thread::new::thread_start::h55e6429cb8ed2e9f
                               at src/libstd/sys/unix/thread.rs:80
  58:     0x7fe35955c6db - start_thread
  59:     0x7fe35906d88f - __clone
  60:                0x0 - <unknown>

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.0.212 (2855b21 2020-02-19)

query stack during panic:
#0 [analysis] running analysis passes on this crate
end of query stack

Absolutely no idea how to make MRE, the code is quite big and generic. This occurred when trying to cargo clippy https://github.com/teloxide/teloxide/tree/dev on the latest nightly.

@Centril
Copy link
Contributor

Centril commented Feb 20, 2020

cc @tmandry @Zoxc @rust-lang/clippy

@Centril Centril changed the title Internal compiler error ICE in GeneratorSubsts / clippy Feb 20, 2020
@jonas-schievink
Copy link
Contributor

Interesting backtrace parts:

  21: rustc::util::bug::bug_fmt
  22: rustc::ty::sty::GeneratorSubsts::split
  23: rustc::ty::sty::GeneratorSubsts::return_ty
  24: clippy_lints::doc::lint_for_missing_headers
  25: <clippy_lints::doc::DocMarkdown as rustc_lint::passes::LateLintPass>::check_impl_item
  26: <rustc_lint::late::LateLintPassObjects as rustc_lint::passes::LateLintPass>::check_impl_item

@jonas-schievink
Copy link
Contributor

Does not happen on nightly-2020-01-27, so might be caused by one of my PRs

@jonas-schievink
Copy link
Contributor

Actually #5181 looks like a more likely candidate. cc @daxpedda

@jonas-schievink
Copy link
Contributor

Does not happen on nightly-2020-02-17, so that confirms #5181 as the most likely candidate

@flip1995
Copy link
Member

Yes, this happens, because of the GeneratorSubsts::return_ty call here:

if match_type(cx, subs.as_generator().return_ty(def_id, cx.tcx), &paths::RESULT);

@flip1995
Copy link
Member

I think this issue should be moved to the Clippy repo.

@flip1995
Copy link
Member

@oli-obk oli-obk transferred this issue from rust-lang/rust Feb 20, 2020
@daxpedda
Copy link
Contributor

😮 so sorry about that!
I am assuming the issue is that return_ty panics if there is no return type? Is there some way to test this before calling return_ty?

@flip1995
Copy link
Member

flip1995 commented Feb 20, 2020

MRE:

pub async fn bar<'a, T: 'a>(_: T) {}

When removing the pubs, the ICE is not triggered. Yeah, because the lint bails out on non-pub items 🤦‍♂️ Playground

@flip1995
Copy link
Member

It panics because of the lifetime bind of the generic param.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants