Skip to content

Error while building with main being extern (a separately compiled C module) #86110

Closed
@eliotmoss

Description

@eliotmoss

Code

Not minimal, but possibly helpful, from src/lib.rs:

extern {
    #[link(name = "libtestline", kind = "static", link_name = "main")]
    fn main() -> isize;
}

Meta

rustc --version --verbose:

rustc 1.54.0-nightly (6c2dd251b 2021-06-05)
binary: rustc
commit-hash: 6c2dd251bbff03c7a3092d43fb5b637eca0810e3
commit-date: 2021-06-05
host: x86_64-unknown-linux-gnu
release: 1.54.0-nightly
LLVM version: 12.0.1

Error output

error: internal compiler error: compiler/rustc_ty_utils/src/ty.rs:461:9: asyncness: expected fn-like node but got `DefId(0:4296 ~ pmu[7eea]::::main)`

thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:1007:9
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.54.0-nightly (6c2dd251b 2021-06-05) running on x86_64-unknown-linux-gnu

note: compiler flags: -C opt-level=3 -C embed-bitcode=no -C opt-level=2 -C linker-plugin-lto=/usr/local/llvm-12.0.1-rc1/lib/LLVMgold.so -C linker=clang -C link-arg=-flto=full -C link-arg=-fuse-ld=/usr/local/llvm-12.0.1-rc1/bin/ld.lld -C target-cpu=x86-64 --crate-type bin

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [asyncness] checking if the function is async: `main`
#1 [analysis] running analysis passes on this crate
end of query stack
Backtrace

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_ty_utils::ty::asyncness
   8: rustc_query_system::query::plumbing::get_query_impl
   9: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::asyncness
  10: rustc_typeck::check_for_entry_fn
  11: rustc_typeck::check_crate
  12: rustc_interface::passes::analysis
  13: rustc_query_system::query::plumbing::get_query_impl
  14: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  15: rustc_interface::passes::QueryContext::enter
  16: rustc_span::with_session_globals

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-lowLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions