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: compiler/rustc_lint/src/types.rs:1132:32: unexpected type in foreign function: [type error] #83621

Closed
chengniansun opened this issue Mar 28, 2021 · 2 comments · Fixed by #83734
Labels
A-ffi Area: Foreign Function Interface (FFI) C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@chengniansun
Copy link

Code

extern "C" {
    static x: _;
}

Meta

rustc --version --verbose:

rustc 1.53.0-nightly (9b0edb7fd 2021-03-27)
binary: rustc
commit-hash: 9b0edb7fddacd6a60a380c1ce59159de597ab270
commit-date: 2021-03-27
host: x86_64-unknown-linux-gnu
release: 1.53.0-nightly
LLVM version: 12.0.0

Error output

warning: static is never used: `x`
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:2:5
  |
2 |     static x: _;
  |     ^^^^^^^^^^^^
  |
  = note: `#[warn(dead_code)]` on by default

error: internal compiler error: compiler/rustc_lint/src/types.rs:1132:32: unexpected type in foreign function: [type error]

thread 'rustc' panicked at 'Box<Any>', /rustc/9b0edb7fddacd6a60a380c1ce59159de597ab270/library/std/src/panic.rs:59:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.53.0-nightly (9b0edb7fd 2021-03-27) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type staticlib

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; 1 warning emitted
Backtrace

warning: static is never used: `x`
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:2:5
  |
2 |     static x: _;
  |     ^^^^^^^^^^^^
  |
  = note: `#[warn(dead_code)]` on by default

error: internal compiler error: compiler/rustc_lint/src/types.rs:1132:32: unexpected type in foreign function: [type error]

thread 'rustc' panicked at 'Box<Any>', /rustc/9b0edb7fddacd6a60a380c1ce59159de597ab270/library/std/src/panic.rs:59:5
stack backtrace:
   0: std::panicking::begin_panic
   1: std::panic::panic_any
   2: rustc_errors::HandlerInner::bug
   3: rustc_errors::Handler::bug
   4: rustc_middle::ty::context::tls::with_opt
   5: rustc_middle::util::bug::opt_span_bug_fmt
   6: rustc_middle::util::bug::bug_fmt
   7: rustc_lint::types::ImproperCTypesVisitor::check_type_for_ffi
   8: rustc_lint::types::ImproperCTypesVisitor::check_type_for_ffi_and_report_errors
   9: <rustc_lint::types::ImproperCTypesDeclarations as rustc_lint::passes::LateLintPass>::check_foreign_item
  10: rustc_hir::intravisit::Visitor::visit_nested_foreign_item
  11: rustc_hir::intravisit::walk_item
  12: rustc_hir::intravisit::Visitor::visit_nested_item
  13: rustc_lint::late::late_lint_mod
  14: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  15: rustc_query_system::query::plumbing::force_query_with_job
  16: rustc_query_system::query::plumbing::get_query_impl
  17: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::lint_mod
  18: rustc_data_structures::sync::join
  19: std::panic::catch_unwind
  20: rustc_session::utils::<impl rustc_session::session::Session>::time
  21: rustc_interface::passes::analysis
  22: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  23: rustc_data_structures::stack::ensure_sufficient_stack
  24: rustc_query_system::query::plumbing::force_query_with_job
  25: rustc_query_system::query::plumbing::get_query_impl
  26: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  27: rustc_interface::passes::QueryContext::enter
  28: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  29: rustc_span::with_source_map
  30: rustc_interface::interface::create_compiler_and_run
  31: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.53.0-nightly (9b0edb7fd 2021-03-27) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type staticlib

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; 1 warning emitted

@chengniansun chengniansun added C-bug Category: This is a bug. 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. labels Mar 28, 2021
@jonas-schievink jonas-schievink added A-ffi Area: Foreign Function Interface (FFI) I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Mar 28, 2021
@JohnTitor
Copy link
Member

The ICE happens because the type placeholder error has been gone since 1.43.

@apiraino
Copy link
Contributor

apiraino commented Apr 1, 2021

Assigning priority as discussed as part of the Prioritization Working Group procedure and removing I-prioritize.

@rustbot label -I-prioritize +P-medium

@rustbot rustbot added P-medium Medium priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Apr 1, 2021
fanninpm added a commit to fanninpm/glacier that referenced this issue Apr 2, 2021
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Apr 2, 2021
@bors bors closed this as completed in 76be7e2 Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ffi Area: Foreign Function Interface (FFI) C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants