Skip to content

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

Closed

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

Activity

  1. added
    C-bugCategory: This is a bug.
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Jun 7, 2021
  2. added
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Jun 7, 2021
  3. apiraino commented on Jun 8, 2021

    @apiraino
    Contributor

    Assigning priority as discussed in the Zulip thread of the Prioritization Working Group.

    @rustbot label -I-prioritize +P-low

  4. added
    P-lowLow priority
    and removed
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Jun 8, 2021
  5. asquared31415 commented on Jun 9, 2021

    @asquared31415
    Contributor

    This appears to have been caused by #84401

  6. asquared31415 commented on Jun 9, 2021

    @asquared31415
    Contributor

    @rustbot claim

  7. Cancelll commented on Jun 10, 2021

    @Cancelll

    A potential duplicate

    union Foo {
        a: isize,
        b: &T,
    }
    enum Bar {
        Boo = [Foo { b: () }.a][3],
    }
  8. asquared31415 commented on Jun 10, 2021

    @asquared31415
    Contributor

    No that's a completely different error

  9. Cancelll commented on Jun 10, 2021

    @Cancelll

    No that's a completely different error

    Sorry I misread the error message, It is probably a duplicate of #83531

  10. asquared31415 commented on Jun 10, 2021

    @asquared31415
    Contributor

    Yep, that looks very similar

  11. added a commit that references this issue on Jul 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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