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

Ffi safe lint ICE with type alias impl trait #64338

bjorn3 opened this issue Sep 10, 2019 · 0 comments

Ffi safe lint ICE with type alias impl trait #64338

bjorn3 opened this issue Sep 10, 2019 · 0 comments


Copy link

@bjorn3 bjorn3 commented Sep 10, 2019


type A = impl Fn();

fn ret_closure() -> A {
    || {}

extern "C" {
    fn a(_: A);

fn main() {}
error: internal compiler error: src/librustc_lint/ Unexpected type in foreign function

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/
   2: std::sys_common::backtrace::_print
             at src/libstd/sys_common/
   3: std::sys_common::backtrace::print
             at src/libstd/sys_common/
   4: std::panicking::default_hook::{{closure}}
             at src/libstd/
   5: std::panicking::default_hook
             at src/libstd/
   6: rustc::util::common::panic_hook
   7: std::panicking::rust_panic_with_hook
             at src/libstd/
   8: std::panicking::begin_panic
   9: rustc_errors::Handler::bug
  10: rustc::util::bug::opt_span_bug_fmt::{{closure}}
  11: rustc::ty::context::tls::with_opt::{{closure}}
  12: rustc::ty::context::tls::with_context_opt
  13: rustc::ty::context::tls::with_opt
  14: rustc::util::bug::opt_span_bug_fmt
  15: rustc::util::bug::bug_fmt
  16: rustc_lint::types::ImproperCTypesVisitor::check_type_for_ffi
  17: rustc_lint::types::ImproperCTypesVisitor::check_type_for_ffi_and_report_errors
  18: <rustc_lint::types::ImproperCTypes as rustc::lint::LateLintPass>::check_foreign_item
  19: rustc::hir::intravisit::walk_item
  20: rustc::hir::intravisit::Visitor::visit_nested_item
  21: rustc::lint::context::late_lint_mod
  22: rustc::ty::query::__query_compute::lint_mod
  23: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::lint_mod>::compute
  24: rustc::dep_graph::graph::DepGraph::with_task_impl
  25: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  26: rustc::lint::context::check_crate::{{closure}}::{{closure}}
  27: rustc::util::common::time
  28: rustc::util::common::time
  29: __rust_maybe_catch_panic
             at src/libpanic_unwind/
  30: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  31: __rust_maybe_catch_panic
             at src/libpanic_unwind/
  32: rustc_interface::passes::analysis::{{closure}}
  33: rustc::util::common::time
  34: rustc_interface::passes::analysis
  35: rustc::ty::query::__query_compute::analysis
  36: rustc::dep_graph::graph::DepGraph::with_task_impl
  37: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  38: rustc::ty::context::tls::enter_global
  39: rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}
  40: rustc_interface::passes::create_global_ctxt::{{closure}}
  41: rustc_interface::passes::BoxedGlobalCtxt::enter
  42: rustc_interface::interface::run_compiler_in_existing_thread_pool
  43: std::thread::local::LocalKey<T>::with
  44: syntax::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
query stack during panic:
#0 [lint_mod] linting top-level module
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error

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

note: we would appreciate a bug report:

note: rustc 1.39.0-nightly (9eae1fc0e 2019-08-23) running on x86_64-unknown-linux-gnu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants