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

Closed
bjorn3 opened this issue Sep 10, 2019 · 0 comments · Fixed by #64359
Closed

Ffi safe lint ICE with type alias impl trait #64338

bjorn3 opened this issue Sep 10, 2019 · 0 comments · Fixed by #64359
Assignees
Labels
A-impl-trait Area: impl Trait. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@bjorn3
Copy link
Member

bjorn3 commented Sep 10, 2019

#![feature(type_alias_impl_trait)]

type A = impl Fn();

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

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

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

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:643:9
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.35/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.35/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:47
   3: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:36
   4: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:200
   5: std::panicking::default_hook
             at src/libstd/panicking.rs:214
   6: rustc::util::common::panic_hook
   7: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:481
   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/lib.rs:80
  30: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  31: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:80
  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: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.39.0-nightly (9eae1fc0e 2019-08-23) running on x86_64-unknown-linux-gnu
@varkor varkor self-assigned this Sep 10, 2019
@varkor varkor added A-impl-trait Area: impl Trait. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Sep 10, 2019
@jonas-schievink jonas-schievink added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Sep 10, 2019
Centril added a commit to Centril/rust that referenced this issue Sep 11, 2019
@bors bors closed this as completed in eb48d6b Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-impl-trait Area: impl Trait. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Development

Successfully merging a pull request may close this issue.

3 participants